mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-02-18 13:29:36 +01:00
fix: View mode wheel zooming does not work (#8452)
* Update App.tsx * fix: prevent zooming browser over DOM --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
parent
ee30225062
commit
2d1d84a47b
@ -2515,7 +2515,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||
addEventListener(
|
||||
this.excalidrawContainerRef.current,
|
||||
EVENT.WHEEL,
|
||||
this.onWheel,
|
||||
this.handleWheel,
|
||||
{ passive: false },
|
||||
),
|
||||
addEventListener(window, EVENT.MESSAGE, this.onWindowMessage, false),
|
||||
@ -4323,13 +4323,6 @@ class App extends React.Component<AppProps, AppState> {
|
||||
},
|
||||
);
|
||||
|
||||
private onWheel = withBatchedUpdates((event: WheelEvent) => {
|
||||
// prevent browser pinch zoom on DOM elements
|
||||
if (!(event.target instanceof HTMLCanvasElement) && event.ctrlKey) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
private onKeyUp = withBatchedUpdates((event: KeyboardEvent) => {
|
||||
if (event.key === KEYS.SPACE) {
|
||||
if (this.state.viewModeEnabled) {
|
||||
@ -10089,6 +10082,11 @@ class App extends React.Component<AppProps, AppState> {
|
||||
event.target instanceof HTMLIFrameElement
|
||||
)
|
||||
) {
|
||||
// prevent zooming the browser (but allow scrolling DOM)
|
||||
if (event[KEYS.CTRL_OR_CMD]) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user