mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix: attach wheel event to exscalidraw container only (#5443)
This commit is contained in:
parent
a7153d9d1d
commit
1ea67ba93d
1 changed files with 9 additions and 2 deletions
|
@ -950,7 +950,10 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
document.removeEventListener(EVENT.COPY, this.onCopy);
|
document.removeEventListener(EVENT.COPY, this.onCopy);
|
||||||
document.removeEventListener(EVENT.PASTE, this.pasteFromClipboard);
|
document.removeEventListener(EVENT.PASTE, this.pasteFromClipboard);
|
||||||
document.removeEventListener(EVENT.CUT, this.onCut);
|
document.removeEventListener(EVENT.CUT, this.onCut);
|
||||||
document.removeEventListener(EVENT.WHEEL, this.onWheel);
|
this.excalidrawContainerRef.current?.removeEventListener(
|
||||||
|
EVENT.WHEEL,
|
||||||
|
this.onWheel,
|
||||||
|
);
|
||||||
this.nearestScrollableContainer?.removeEventListener(
|
this.nearestScrollableContainer?.removeEventListener(
|
||||||
EVENT.SCROLL,
|
EVENT.SCROLL,
|
||||||
this.onScroll,
|
this.onScroll,
|
||||||
|
@ -999,7 +1002,11 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
this.removeEventListeners();
|
this.removeEventListeners();
|
||||||
document.addEventListener(EVENT.POINTER_UP, this.removePointer); // #3553
|
document.addEventListener(EVENT.POINTER_UP, this.removePointer); // #3553
|
||||||
document.addEventListener(EVENT.COPY, this.onCopy);
|
document.addEventListener(EVENT.COPY, this.onCopy);
|
||||||
document.addEventListener(EVENT.WHEEL, this.onWheel, { passive: false });
|
this.excalidrawContainerRef.current?.addEventListener(
|
||||||
|
EVENT.WHEEL,
|
||||||
|
this.onWheel,
|
||||||
|
{ passive: false },
|
||||||
|
);
|
||||||
|
|
||||||
if (this.props.handleKeyboardGlobally) {
|
if (this.props.handleKeyboardGlobally) {
|
||||||
document.addEventListener(EVENT.KEYDOWN, this.onKeyDown, false);
|
document.addEventListener(EVENT.KEYDOWN, this.onKeyDown, false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue