Skip to content

Commit

Permalink
fix: slow down zoom speed for pinch-to-zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
ccarmichael-uncharted committed Nov 30, 2023
1 parent e0ce2d3 commit 030dbc7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/UX/mouse/MouseHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,16 @@ export class MouseHandler extends EventEmitter.mixin(UXModule) {
private handleWheelEvent(e: WheelEvent, state: MouseState): void {
this.setMouseState(state);

let delta;
if ('wheelDeltaY' in e) {
delta = -(e as any).wheelDeltaY / 120;
} else {
delta = (e.deltaY < 1) ? -1 : 1;
}
if (e.deltaY) {
const sign = e.deltaY / Math.abs(e.deltaY);

this.emitEvents([{
event: kEvents.wheel,
args: [delta],
}]);
const delta = sign * Math.min(Math.abs(e.deltaY), 10) / 10;

this.emitEvents([{
event: kEvents.wheel,
args: [delta],
}]);
}
}

private handleMouseEvent(e: MouseEvent): void {
Expand Down

0 comments on commit 030dbc7

Please sign in to comment.