mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Visibility and zooming when canvas offset is not zero (#2534)
This commit is contained in:
parent
60864ace54
commit
4c7b1a2269
5 changed files with 53 additions and 19 deletions
|
@ -763,13 +763,20 @@ const isVisibleElement = (
|
|||
) => {
|
||||
const [x1, y1, x2, y2] = getElementBounds(element); // scene coordinates
|
||||
const topLeftSceneCoords = viewportCoordsToSceneCoords(
|
||||
{ clientX: 0, clientY: 0 },
|
||||
{
|
||||
clientX: viewTransformations.offsetLeft,
|
||||
clientY: viewTransformations.offsetTop,
|
||||
},
|
||||
viewTransformations,
|
||||
);
|
||||
const bottomRightSceneCoords = viewportCoordsToSceneCoords(
|
||||
{ clientX: canvasWidth, clientY: canvasHeight },
|
||||
{
|
||||
clientX: viewTransformations.offsetLeft + canvasWidth,
|
||||
clientY: viewTransformations.offsetTop + canvasHeight,
|
||||
},
|
||||
viewTransformations,
|
||||
);
|
||||
|
||||
return (
|
||||
topLeftSceneCoords.x <= x2 &&
|
||||
topLeftSceneCoords.y <= y2 &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue