mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-14 21:10:37 +02:00
check if browser zoomed on mount
This commit is contained in:
@@ -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));
|
||||||
|
Reference in New Issue
Block a user