limit zoom
This commit is contained in:
parent
4e2026e47d
commit
0607003903
@ -3917,6 +3917,20 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// RULE: cannot go below the minimum zoom level if zoom lock is enabled
|
||||||
|
const constrainedState =
|
||||||
|
newState.scrollConstraints && newState.scrollConstraints.lockZoom
|
||||||
|
? constrainScrollState(newState, "elastic")
|
||||||
|
: newState;
|
||||||
|
if (constrainedState.zoom.value > newState.zoom.value) {
|
||||||
|
newState.zoom = constrainedState.zoom;
|
||||||
|
newState.scrollX = constrainedState.scrollX;
|
||||||
|
newState.scrollY = constrainedState.scrollY;
|
||||||
|
|
||||||
|
this.debounceConstrainScrollState(newState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
if (this.state.scrollConstraints) {
|
if (this.state.scrollConstraints) {
|
||||||
// debounce to allow centering on user's cursor position before constraining
|
// debounce to allow centering on user's cursor position before constraining
|
||||||
|
Loading…
x
Reference in New Issue
Block a user