mirror of
https://github.com/excalidraw/excalidraw.git
synced 2024-11-02 03:25:53 +01:00
fix: prevent panning to trigger history on macos chrome (#7671)
This commit is contained in:
parent
def1df2c68
commit
adc4c9f484
@ -1410,6 +1410,13 @@ class App extends React.Component<AppProps, AppState> {
|
||||
});
|
||||
};
|
||||
|
||||
private toggleOverscrollBehavior(event: React.PointerEvent) {
|
||||
// when pointer inside editor, disable overscroll behavior to prevent
|
||||
// panning to trigger history back/forward on MacOS Chrome
|
||||
document.documentElement.style.overscrollBehaviorX =
|
||||
event.type === "pointerenter" ? "none" : "auto";
|
||||
}
|
||||
|
||||
public render() {
|
||||
const selectedElements = this.scene.getSelectedElements(this.state);
|
||||
const { renderTopRightUI, renderCustomStats } = this.props;
|
||||
@ -1463,6 +1470,8 @@ class App extends React.Component<AppProps, AppState> {
|
||||
onKeyDown={
|
||||
this.props.handleKeyboardGlobally ? undefined : this.onKeyDown
|
||||
}
|
||||
onPointerEnter={this.toggleOverscrollBehavior}
|
||||
onPointerLeave={this.toggleOverscrollBehavior}
|
||||
>
|
||||
<AppContext.Provider value={this}>
|
||||
<AppPropsContext.Provider value={this.props}>
|
||||
@ -2455,6 +2464,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||
isSomeElementSelected.clearCache();
|
||||
selectGroupsForSelectedElements.clearCache();
|
||||
touchTimeout = 0;
|
||||
document.documentElement.style.overscrollBehaviorX = "";
|
||||
}
|
||||
|
||||
private onResize = withBatchedUpdates(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user