mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: fixed detecting viewport outside of constraints
This commit is contained in:
parent
9bc874a61e
commit
82aa1cf19d
1 changed files with 4 additions and 8 deletions
|
@ -328,18 +328,14 @@ const isViewportOutsideOfConstrainedArea = (state: AppState) => {
|
|||
const scrollConstraints = alignScrollConstraints(inverseScrollConstraints);
|
||||
|
||||
// Adjust scroll and dimensions according to the zoom level
|
||||
const adjustedScrollX = scrollX * zoom.value;
|
||||
const adjustedScrollY = scrollY * zoom.value;
|
||||
const adjustedWidth = width / zoom.value;
|
||||
const adjustedHeight = height / zoom.value;
|
||||
|
||||
return (
|
||||
adjustedScrollX > scrollConstraints.x ||
|
||||
adjustedScrollX - adjustedWidth <
|
||||
scrollConstraints.x - scrollConstraints.width ||
|
||||
adjustedScrollY > scrollConstraints.y ||
|
||||
adjustedScrollY - adjustedHeight <
|
||||
scrollConstraints.y - scrollConstraints.height
|
||||
scrollX > scrollConstraints.x ||
|
||||
scrollX - adjustedWidth < scrollConstraints.x - scrollConstraints.width ||
|
||||
scrollY > scrollConstraints.y ||
|
||||
scrollY - adjustedHeight < scrollConstraints.y - scrollConstraints.height
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue