fix: fixed detecting viewport outside of constraints

This commit is contained in:
Arnošt Pleskot 2024-02-09 15:31:51 +01:00
parent 9bc874a61e
commit 82aa1cf19d
No known key found for this signature in database

View file

@ -328,18 +328,14 @@ const isViewportOutsideOfConstrainedArea = (state: AppState) => {
const scrollConstraints = alignScrollConstraints(inverseScrollConstraints); const scrollConstraints = alignScrollConstraints(inverseScrollConstraints);
// Adjust scroll and dimensions according to the zoom level // 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 adjustedWidth = width / zoom.value;
const adjustedHeight = height / zoom.value; const adjustedHeight = height / zoom.value;
return ( return (
adjustedScrollX > scrollConstraints.x || scrollX > scrollConstraints.x ||
adjustedScrollX - adjustedWidth < scrollX - adjustedWidth < scrollConstraints.x - scrollConstraints.width ||
scrollConstraints.x - scrollConstraints.width || scrollY > scrollConstraints.y ||
adjustedScrollY > scrollConstraints.y || scrollY - adjustedHeight < scrollConstraints.y - scrollConstraints.height
adjustedScrollY - adjustedHeight <
scrollConstraints.y - scrollConstraints.height
); );
}; };