fix: make bounds independent of scene (#7679)

* fix: make bounds independent of scene

* pass only elements to getCommonBounds

* lint

* pass elementsMap to getVisibleAndNonSelectedElements
This commit is contained in:
Aakansha Doshi
2024-02-19 19:39:14 +05:30
committed by GitHub
parent 9013c84524
commit 79d9dc2f8f
11 changed files with 106 additions and 59 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import { ExcalidrawElement } from "./types";
import { ElementsMap, ExcalidrawElement } from "./types";
import { mutateElement } from "./mutateElement";
import { isFreeDrawElement, isLinearElement } from "./typeChecks";
import { SHIFT_LOCKING_ANGLE } from "../constants";
@@ -26,8 +26,9 @@ export const isElementInViewport = (
scrollX: number;
scrollY: number;
},
elementsMap: ElementsMap,
) => {
const [x1, y1, x2, y2] = getElementBounds(element); // scene coordinates
const [x1, y1, x2, y2] = getElementBounds(element, elementsMap); // scene coordinates
const topLeftSceneCoords = viewportCoordsToSceneCoords(
{
clientX: viewTransformations.offsetLeft,