mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-27 00:44:22 +01:00
a more robust check
This commit is contained in:
@@ -11159,10 +11159,20 @@ class App extends React.Component<AppProps, AppState> {
|
||||
event: WheelEvent | React.WheelEvent<HTMLDivElement | HTMLCanvasElement>,
|
||||
) => {
|
||||
// if not scrolling on canvas/wysiwyg, ignore
|
||||
const path = (event as any).composedPath?.() as EventTarget[] | undefined;
|
||||
const isOnExcalidrawCanvas =
|
||||
path?.some(
|
||||
(n) =>
|
||||
n instanceof HTMLCanvasElement &&
|
||||
n.classList?.contains("excalidraw__canvas"),
|
||||
) ||
|
||||
(event.target as Element | null)?.closest?.(
|
||||
"canvas.excalidraw__canvas",
|
||||
) != null;
|
||||
|
||||
if (
|
||||
!(
|
||||
(event.target instanceof HTMLCanvasElement &&
|
||||
event.target.classList.contains("excalidraw__canvas")) ||
|
||||
isOnExcalidrawCanvas ||
|
||||
event.target instanceof HTMLTextAreaElement ||
|
||||
event.target instanceof HTMLIFrameElement
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user