1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Remove the skipEmpty parameter from Util.intersect (PR 11059 follow-up)

Looking at this again, it struck me that added functionality in `Util.intersect` is probably more confusing than helpful in general; sorry about the churn in this code!
Based on the parameter name you'd probably expect it to only match when the intersection is `[0, 0,  0, 0]` and not when only one component is zero, hence the `skipEmpty` parameter thus feels too tightly coupled to the `Page.view` getter.
This commit is contained in:
Jonas Jenwald 2019-08-11 13:40:58 +02:00
parent 85acc9acac
commit 7ee370a394
2 changed files with 3 additions and 7 deletions

View file

@ -137,8 +137,8 @@ class Page {
if (cropBox === mediaBox || isArrayEqual(cropBox, mediaBox)) {
view = mediaBox;
} else {
const box = Util.intersect(cropBox, mediaBox, /* skipEmpty = */ true);
if (box) {
const box = Util.intersect(cropBox, mediaBox);
if (box && ((box[2] - box[0]) !== 0 && (box[3] - box[1]) !== 0)) {
view = box;
} else {
warn('Empty /CropBox and /MediaBox intersection.');