mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: fix overscroll animation trigger when zoomed in
This commit is contained in:
parent
266069ae05
commit
b40fd65404
1 changed files with 12 additions and 6 deletions
|
@ -294,13 +294,19 @@ const isViewportOutsideOfConstrainedArea = (state: AppState) => {
|
||||||
|
|
||||||
const { scrollX, scrollY, width, height, scrollConstraints, zoom } = state;
|
const { scrollX, scrollY, width, height, scrollConstraints, zoom } = state;
|
||||||
|
|
||||||
|
// 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 (
|
return (
|
||||||
scrollX > scrollConstraints.x ||
|
adjustedScrollX > scrollConstraints.x ||
|
||||||
scrollX - width <
|
adjustedScrollX - adjustedWidth <
|
||||||
scrollConstraints.x - scrollConstraints.width * zoom.value ||
|
scrollConstraints.x - scrollConstraints.width ||
|
||||||
scrollY > scrollConstraints.y ||
|
adjustedScrollY > scrollConstraints.y ||
|
||||||
scrollY - height <
|
adjustedScrollY - adjustedHeight <
|
||||||
scrollConstraints.y - scrollConstraints.height * zoom.value
|
scrollConstraints.y - scrollConstraints.height
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue