mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix: show toast when browser zoom is not 100%
This commit is contained in:
parent
f1bc90e08a
commit
d12b592232
2 changed files with 15 additions and 1 deletions
|
@ -887,6 +887,19 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private onResize = withBatchedUpdates(() => {
|
private onResize = withBatchedUpdates(() => {
|
||||||
|
if (!this.deviceType.isMobile) {
|
||||||
|
const scrollBarWidth = 10;
|
||||||
|
const widthRatio =
|
||||||
|
(window.outerWidth - scrollBarWidth) / window.innerWidth;
|
||||||
|
const isBrowserZoomed =
|
||||||
|
// Device pixel ratio is 2 when zoom is 100%
|
||||||
|
window.devicePixelRatio !== 2 || widthRatio < 0.9 || widthRatio > 1;
|
||||||
|
if (isBrowserZoomed) {
|
||||||
|
this.setToastMessage(t("alerts.browserZoom"));
|
||||||
|
} else {
|
||||||
|
this.clearToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
this.scene
|
this.scene
|
||||||
.getElementsIncludingDeleted()
|
.getElementsIncludingDeleted()
|
||||||
.forEach((element) => invalidateShapeForElement(element));
|
.forEach((element) => invalidateShapeForElement(element));
|
||||||
|
|
|
@ -181,7 +181,8 @@
|
||||||
"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.",
|
||||||
|
|
Loading…
Add table
Reference in a new issue