mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-06 13:54:24 +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>,
|
event: WheelEvent | React.WheelEvent<HTMLDivElement | HTMLCanvasElement>,
|
||||||
) => {
|
) => {
|
||||||
// if not scrolling on canvas/wysiwyg, ignore
|
// 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 (
|
if (
|
||||||
!(
|
!(
|
||||||
(event.target instanceof HTMLCanvasElement &&
|
isOnExcalidrawCanvas ||
|
||||||
event.target.classList.contains("excalidraw__canvas")) ||
|
|
||||||
event.target instanceof HTMLTextAreaElement ||
|
event.target instanceof HTMLTextAreaElement ||
|
||||||
event.target instanceof HTMLIFrameElement
|
event.target instanceof HTMLIFrameElement
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user