feat: Unify scroll constraint

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2026-06-26 17:33:37 +00:00
parent dba56d3edc
commit 5974e463d8
5 changed files with 71 additions and 43 deletions
+3 -2
View File
@@ -26,7 +26,8 @@ const ScrollConstraintsDebugFooter = ({
const setLock = useCallback(
(nextLock: ScrollConstraints) => {
excalidrawAPI?.setScrollConstraints(nextLock);
// pass an empty target so the constraints are applied without scrolling
excalidrawAPI?.scrollToContent([], { scrollConstraints: nextLock });
setActiveLock(nextLock);
},
[excalidrawAPI],
@@ -38,7 +39,7 @@ const ScrollConstraintsDebugFooter = ({
}
if (activeLock) {
excalidrawAPI.setScrollConstraints(null);
excalidrawAPI.scrollToContent([], { scrollConstraints: null });
setActiveLock(null);
return;
}