mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: revert browser toast for high/low zoom (#5495)
This commit is contained in:
parent
966ca2ffa6
commit
91fc22182c
2 changed files with 2 additions and 21 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue