feat: update constraints on window resize

This commit is contained in:
Arnošt Pleskot 2023-07-04 17:10:20 +02:00
parent 71f7960606
commit f7e8056abe
No known key found for this signature in database

View File

@ -7642,11 +7642,15 @@ class App extends React.Component<AppProps, AppState> {
const { scrollX, scrollY, scrollConstraints, width, height, zoom } = const { scrollX, scrollY, scrollConstraints, width, height, zoom } =
this.state; this.state;
// Skip if scroll constraints are not defined or if the zoom level or viewport dimensions have not changed.
// Constrains and scene will update on change of viewport dimensions.
if ( if (
!scrollConstraints || !scrollConstraints ||
(this.state.zoom.value === prevState.zoom.value && (this.state.zoom.value === prevState.zoom.value &&
this.state.scrollX === prevState.scrollX && this.state.scrollX === prevState.scrollX &&
this.state.scrollY === prevState.scrollY) this.state.scrollY === prevState.scrollY &&
this.state.width === prevState.width &&
this.state.height === prevState.height)
) { ) {
return null; return null;
} }