mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: prevent jumping when trying to zoom out the zoomFactor
This commit is contained in:
parent
4c62eef7da
commit
b5bf346229
1 changed files with 11 additions and 5 deletions
|
@ -401,10 +401,16 @@ export const constrainScrollState = (
|
||||||
allowOverscroll,
|
allowOverscroll,
|
||||||
});
|
});
|
||||||
|
|
||||||
const constrainedValues = constrainScrollValues({
|
const constrainedValues =
|
||||||
|
zoom.value >= constraints.constrainedZoom.value // when trying to zoom out of the constrained area we want to keep the viewport centered and prevent jumping caused by change of scrollX and scrollY values when zooming
|
||||||
|
? constrainScrollValues({
|
||||||
...constraints,
|
...constraints,
|
||||||
scrollX,
|
scrollX,
|
||||||
scrollY,
|
scrollY,
|
||||||
|
})
|
||||||
|
: calculateConstrainedScrollCenter(state, {
|
||||||
|
scrollX,
|
||||||
|
scrollY,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!canUseMemoizedValues) {
|
if (!canUseMemoizedValues) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue