feat: Unify scroll constraint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user