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 { } else {
this.updateDOMRect(this.initializeScene); this.updateDOMRect(this.initializeScene);
} }
this.checkIfBrowserZoomed();
} }
public componentWillUnmount() { public componentWillUnmount() {
@ -921,25 +920,8 @@ class App extends React.Component<AppProps, AppState> {
clearTimeout(touchTimeout); clearTimeout(touchTimeout);
touchTimeout = 0; 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(() => { private onResize = withBatchedUpdates(() => {
this.checkIfBrowserZoomed();
this.scene this.scene
.getElementsIncludingDeleted() .getElementsIncludingDeleted()
.forEach((element) => invalidateShapeForElement(element)); .forEach((element) => invalidateShapeForElement(element));

View File

@ -187,8 +187,7 @@
"invalidSceneUrl": "Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.", "invalidSceneUrl": "Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.",
"resetLibrary": "This will clear your library. Are you sure?", "resetLibrary": "This will clear your library. Are you sure?",
"removeItemsFromsLibrary": "Delete {{count}} item(s) from library?", "removeItemsFromsLibrary": "Delete {{count}} item(s) from library?",
"invalidEncryptionKey": "Encryption key must be of 22 characters. Live collaboration is disabled.", "invalidEncryptionKey": "Encryption key must be of 22 characters. Live collaboration is disabled."
"browserZoom": "Your browser's zoom level is not set to 100% which may cause the board to display incorrectly"
}, },
"errors": { "errors": {
"unsupportedFileType": "Unsupported file type.", "unsupportedFileType": "Unsupported file type.",