Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistant mouse wheel zoom step on Firefox #10627

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions modules/util/zoom_pan.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Adapted from d3-zoom to handle pointer events.
// https://github.com/d3/d3-zoom/blob/523ccff340187a3e3c044eaa4d4a7391ea97272b/src/zoom.js

import { dispatch as d3_dispatch } from 'd3-dispatch';
import { interpolateZoom } from 'd3-interpolate';
import { select as d3_select } from 'd3-selection';
Expand Down Expand Up @@ -30,7 +27,9 @@ function defaultExtent() {
}

function defaultWheelDelta(d3_event) {
return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 0.002);
// Normalize WheelEvent.deltaY to 100 for consistency across browsers
const normalizedDeltaY = d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.98 : d3_event.deltaMode ? 0.925 : 0.002);
return -normalizedDeltaY;
}

function defaultConstrain(transform, extent, translateExtent) {
Expand Down