mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix scrollToCenter when no elements supplied (#1222)
* fix scrollToCenter when no elements supplied * make getCommonBounds return default values on empty elements
This commit is contained in:
parent
b97520400a
commit
4dd947b261
2 changed files with 11 additions and 0 deletions
|
@ -187,6 +187,10 @@ export function getArrowPoints(
|
|||
}
|
||||
|
||||
export function getCommonBounds(elements: readonly ExcalidrawElement[]) {
|
||||
if (!elements.length) {
|
||||
return [0, 0, 0, 0];
|
||||
}
|
||||
|
||||
let minX = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let minY = Infinity;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue