From edf54d15438f24b2d744015ee8f044ebaee596d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=C5=A1t=20Pleskot?= Date: Wed, 13 Sep 2023 15:58:38 +0200 Subject: [PATCH] fix: scale constrained area based on zoom --- src/scene/scrollConstraints.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/scene/scrollConstraints.ts b/src/scene/scrollConstraints.ts index b88db8fe17..eea06c71b5 100644 --- a/src/scene/scrollConstraints.ts +++ b/src/scene/scrollConstraints.ts @@ -292,13 +292,15 @@ const isViewportOutsideOfConstrainedArea = (state: AppState) => { return false; } - const { scrollX, scrollY, width, height, scrollConstraints } = state; + const { scrollX, scrollY, width, height, scrollConstraints, zoom } = state; return ( scrollX > scrollConstraints.x || - scrollX - width < scrollConstraints.x - scrollConstraints.width || - scrollY < scrollConstraints.y || - scrollY + height > scrollConstraints.y + scrollConstraints.height + scrollX - width < + scrollConstraints.x - scrollConstraints.width * zoom.value || + scrollY > scrollConstraints.y || + scrollY - height < + scrollConstraints.y - scrollConstraints.height * zoom.value ); };