Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Sep 30, 2024
1 parent 14b8fcc commit d286a6f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/project-editor/flow/runtime/wasm-runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1313,10 +1313,15 @@ export const WasmCanvas = observer(
};

onWheel = (event: WheelEvent) => {
if (this.canvasRef.current) {
this.canvasRef.current.focus();
if (!this.canvasRef.current) {
return;
}

event.preventDefault();
event.stopPropagation();

this.canvasRef.current.focus();

const wasmRuntime = this.context.runtime as WasmRuntime;
if (!wasmRuntime) {
return;
Expand Down Expand Up @@ -1399,7 +1404,9 @@ export const WasmCanvas = observer(
this.onPointerCancel,
true
);
document.addEventListener("wheel", this.onWheel, true);
canvas.addEventListener("wheel", this.onWheel, {
passive: false
});

canvas.focus();
}
Expand All @@ -1425,7 +1432,7 @@ export const WasmCanvas = observer(
this.onPointerCancel,
true
);
document.removeEventListener("wheel", this.onWheel, true);
canvas.removeEventListener("wheel", this.onWheel, false);
}
}

Expand Down

0 comments on commit d286a6f

Please sign in to comment.