fix: revert browser toast for high/low zoom (#5495)

This commit is contained in:
Aakansha Doshi 2022-07-27 20:49:29 +05:30 committed by GitHub
parent 966ca2ffa6
commit 91fc22182c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 21 deletions

View file

@ -908,7 +908,6 @@ class App extends React.Component<AppProps, AppState> {
} else {
this.updateDOMRect(this.initializeScene);
}
this.checkIfBrowserZoomed();
}
public componentWillUnmount() {
@ -921,25 +920,8 @@ class App extends React.Component<AppProps, AppState> {
clearTimeout(touchTimeout);
touchTimeout = 0;
}
private checkIfBrowserZoomed = () => {
if (!this.device.isMobile) {
const scrollBarWidth = 10;
const widthRatio =
(window.outerWidth - scrollBarWidth) / window.innerWidth;
const isBrowserZoomed = widthRatio < 0.75 || widthRatio > 1.1;
if (isBrowserZoomed) {
this.setToast({
message: t("alerts.browserZoom"),
closable: true,
duration: Infinity,
});
} else {
this.setToast(null);
}
}
};
private onResize = withBatchedUpdates(() => {
this.checkIfBrowserZoomed();
this.scene
.getElementsIncludingDeleted()
.forEach((element) => invalidateShapeForElement(element));