fix: attach wheel event to exscalidraw container only (#5443)

This commit is contained in:
Aakansha Doshi 2022-07-14 11:08:20 +05:30 committed by GitHub
parent a7153d9d1d
commit 1ea67ba93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -950,7 +950,10 @@ class App extends React.Component<AppProps, AppState> {
document.removeEventListener(EVENT.COPY, this.onCopy);
document.removeEventListener(EVENT.PASTE, this.pasteFromClipboard);
document.removeEventListener(EVENT.CUT, this.onCut);
document.removeEventListener(EVENT.WHEEL, this.onWheel);
this.excalidrawContainerRef.current?.removeEventListener(
EVENT.WHEEL,
this.onWheel,
);
this.nearestScrollableContainer?.removeEventListener(
EVENT.SCROLL,
this.onScroll,
@ -999,7 +1002,11 @@ class App extends React.Component<AppProps, AppState> {
this.removeEventListeners();
document.addEventListener(EVENT.POINTER_UP, this.removePointer); // #3553
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) {
document.addEventListener(EVENT.KEYDOWN, this.onKeyDown, false);