|
@@ -166,7 +166,7 @@ import {
|
|
isAndroid,
|
|
isAndroid,
|
|
} from "../keys";
|
|
} from "../keys";
|
|
import { distance2d, getGridPoint, isPathALoop } from "../math";
|
|
import { distance2d, getGridPoint, isPathALoop } from "../math";
|
|
-import { renderScene } from "../renderer";
|
|
|
|
|
|
+import { renderSceneThrottled } from "../renderer/renderScene";
|
|
import { invalidateShapeForElement } from "../renderer/renderElement";
|
|
import { invalidateShapeForElement } from "../renderer/renderElement";
|
|
import {
|
|
import {
|
|
calculateScrollCenter,
|
|
calculateScrollCenter,
|
|
@@ -1193,7 +1193,8 @@ class App extends React.Component<AppProps, AppState> {
|
|
element.id !== this.state.editingElement.id
|
|
element.id !== this.state.editingElement.id
|
|
);
|
|
);
|
|
});
|
|
});
|
|
- const { atLeastOneVisibleElement, scrollBars } = renderScene(
|
|
|
|
|
|
+
|
|
|
|
+ renderSceneThrottled(
|
|
renderingElements,
|
|
renderingElements,
|
|
this.state,
|
|
this.state,
|
|
this.state.selectionElement,
|
|
this.state.selectionElement,
|
|
@@ -1216,24 +1217,25 @@ class App extends React.Component<AppProps, AppState> {
|
|
isExporting: false,
|
|
isExporting: false,
|
|
renderScrollbars: !this.device.isMobile,
|
|
renderScrollbars: !this.device.isMobile,
|
|
},
|
|
},
|
|
- );
|
|
|
|
|
|
+ ({ atLeastOneVisibleElement, scrollBars }) => {
|
|
|
|
+ if (scrollBars) {
|
|
|
|
+ currentScrollBars = scrollBars;
|
|
|
|
+ }
|
|
|
|
+ const scrolledOutside =
|
|
|
|
+ // hide when editing text
|
|
|
|
+ isTextElement(this.state.editingElement)
|
|
|
|
+ ? false
|
|
|
|
+ : !atLeastOneVisibleElement && renderingElements.length > 0;
|
|
|
|
+ if (this.state.scrolledOutside !== scrolledOutside) {
|
|
|
|
+ this.setState({ scrolledOutside });
|
|
|
|
+ }
|
|
|
|
|
|
- if (scrollBars) {
|
|
|
|
- currentScrollBars = scrollBars;
|
|
|
|
- }
|
|
|
|
- const scrolledOutside =
|
|
|
|
- // hide when editing text
|
|
|
|
- isTextElement(this.state.editingElement)
|
|
|
|
- ? false
|
|
|
|
- : !atLeastOneVisibleElement && renderingElements.length > 0;
|
|
|
|
- if (this.state.scrolledOutside !== scrolledOutside) {
|
|
|
|
- this.setState({ scrolledOutside });
|
|
|
|
- }
|
|
|
|
|
|
+ this.scheduleImageRefresh();
|
|
|
|
+ },
|
|
|
|
+ );
|
|
|
|
|
|
this.history.record(this.state, this.scene.getElementsIncludingDeleted());
|
|
this.history.record(this.state, this.scene.getElementsIncludingDeleted());
|
|
|
|
|
|
- this.scheduleImageRefresh();
|
|
|
|
-
|
|
|
|
// Do not notify consumers if we're still loading the scene. Among other
|
|
// Do not notify consumers if we're still loading the scene. Among other
|
|
// potential issues, this fixes a case where the tab isn't focused during
|
|
// potential issues, this fixes a case where the tab isn't focused during
|
|
// init, which would trigger onChange with empty elements, which would then
|
|
// init, which would trigger onChange with empty elements, which would then
|