check if browser zoomed on mount

This commit is contained in:
Aakansha Doshi 2022-07-07 14:34:36 +05:30
parent 7ac79b7799
commit a85b3147ce

View file

@ -772,6 +772,7 @@ class App extends React.Component<AppProps, AppState> {
? { ...scene.appState.activeTool, type: "selection" } ? { ...scene.appState.activeTool, type: "selection" }
: scene.appState.activeTool, : scene.appState.activeTool,
isLoading: false, isLoading: false,
toastMessage: this.state.toastMessage || null,
}; };
if (initialData?.scrollToContent) { if (initialData?.scrollToContent) {
scene.appState = { scene.appState = {
@ -910,6 +911,7 @@ class App extends React.Component<AppProps, AppState> {
} else { } else {
this.updateDOMRect(this.initializeScene); this.updateDOMRect(this.initializeScene);
} }
this.checkIfBrowserZoomed();
} }
public componentWillUnmount() { public componentWillUnmount() {
@ -922,8 +924,7 @@ class App extends React.Component<AppProps, AppState> {
clearTimeout(touchTimeout); clearTimeout(touchTimeout);
touchTimeout = 0; touchTimeout = 0;
} }
private checkIfBrowserZoomed = () => {
private onResize = withBatchedUpdates(() => {
if (!this.device.isMobile) { if (!this.device.isMobile) {
const scrollBarWidth = 10; const scrollBarWidth = 10;
const widthRatio = const widthRatio =
@ -935,6 +936,9 @@ class App extends React.Component<AppProps, AppState> {
this.clearToast(); this.clearToast();
} }
} }
};
private onResize = withBatchedUpdates(() => {
this.checkIfBrowserZoomed();
this.scene this.scene
.getElementsIncludingDeleted() .getElementsIncludingDeleted()
.forEach((element) => invalidateShapeForElement(element)); .forEach((element) => invalidateShapeForElement(element));