fix: prevent jumping when trying to zoom out the zoomFactor
This commit is contained in:
parent
4c62eef7da
commit
b5bf346229
@ -401,10 +401,16 @@ export const constrainScrollState = (
|
||||
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,
|
||||
scrollX,
|
||||
scrollY,
|
||||
})
|
||||
: calculateConstrainedScrollCenter(state, {
|
||||
scrollX,
|
||||
scrollY,
|
||||
});
|
||||
|
||||
if (!canUseMemoizedValues) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user