fix: do not animate empty scene

This commit is contained in:
Arnošt Pleskot 2023-08-01 16:30:45 +02:00
parent d24a032dbb
commit 04e23e1d29
No known key found for this signature in database

View File

@ -2012,7 +2012,6 @@ class App extends React.Component<AppProps, AppState> {
cursorButton, cursorButton,
} = this.state; } = this.state;
// TODO: this could be replaced with memoization function like _.memoize()
const canUseMemoizedConstraints = const canUseMemoizedConstraints =
isShallowEqual(scrollConstraints, prevState.scrollConstraints ?? {}) && isShallowEqual(scrollConstraints, prevState.scrollConstraints ?? {}) &&
isShallowEqual( isShallowEqual(
@ -2058,7 +2057,8 @@ class App extends React.Component<AppProps, AppState> {
shouldAnimate: shouldAnimate:
isViewportOutsideOfConstrainedArea && isViewportOutsideOfConstrainedArea &&
this.state.cursorButton !== "down" && this.state.cursorButton !== "down" &&
prevState.zoom.value === this.state.zoom.value, prevState.zoom.value === this.state.zoom.value &&
this.scene.getElementsIncludingDeleted().length > 0, // Do not animate when app is initialized but scene is empty - this would cause flickering
}); });
} }