This commit is contained in:
Rainer Simon 2020-07-09 12:36:30 +02:00
parent 49b0481b83
commit 779629ed2f
1 changed files with 9 additions and 5 deletions

View File

@ -93,15 +93,19 @@ const mergeBounds = clientBounds => {
};
const extend = function(a, b) {
a.x = Math.min(a.x, b.x);
a.left = Math.min(a.left, b.left);
a.width = a.width + b.width;
a.right = Math.max(a.right + b.right);
const x = Math.min(a.x, b.x);
const left = Math.min(a.left, b.left);
const y = Math.max(a.y, b.y);
const right = Math.max(a.right, b.right);
const width = a.width + b.width;
const { bottom, height, top } = a;
return { bottom, height, left, right, top, width, x, y };
};
if (previous) {
if (isConsecutive(previous, bbox))
extend(previous, bbox);
merged[merged.length - 1] = extend(previous, bbox);
else
merged.push(bbox);
} else {