mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: perf regression in getCommonBounds
(#8429)
This commit is contained in:
parent
824ad603e1
commit
5facc0d6da
1 changed files with 3 additions and 4 deletions
|
@ -749,11 +749,10 @@ export const getCommonBounds = (
|
||||||
let minY = Infinity;
|
let minY = Infinity;
|
||||||
let maxY = -Infinity;
|
let maxY = -Infinity;
|
||||||
|
|
||||||
|
const _elementsMap = elementsMap || arrayToMap(elements);
|
||||||
|
|
||||||
elements.forEach((element) => {
|
elements.forEach((element) => {
|
||||||
const [x1, y1, x2, y2] = getElementBounds(
|
const [x1, y1, x2, y2] = getElementBounds(element, _elementsMap);
|
||||||
element,
|
|
||||||
elementsMap || arrayToMap(elements),
|
|
||||||
);
|
|
||||||
minX = Math.min(minX, x1);
|
minX = Math.min(minX, x1);
|
||||||
minY = Math.min(minY, y1);
|
minY = Math.min(minY, y1);
|
||||||
maxX = Math.max(maxX, x2);
|
maxX = Math.max(maxX, x2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue