Skip to content

Commit

Permalink
Mouse wheel no longer scrolls page when scrolling in on the canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
csprance committed Aug 1, 2022
1 parent dae7284 commit a4f5945
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/graphtoy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export default class Grapher {
(ev) => {
this.iMouseWheel(ev);
},
{ passive: true },
{ passive: false },
);

this.mCanvas.addEventListener(
Expand Down Expand Up @@ -606,6 +606,7 @@ export default class Grapher {
}

private iMouseWheel(e: WheelEvent) {
e.preventDefault();
const sFactor = 1.1;
const scale = e.deltaY < 0 ? 1.0 / sFactor : sFactor;
this.mRa = this.mRa * scale;
Expand Down

0 comments on commit a4f5945

Please sign in to comment.