Merge pull request #15959 from Snuffleupagus/normalizeWheelEventDelta-tweaks
Tweak the `normalizeWheelEventDelta` helper function
This commit is contained in:
commit
ce941255e2
@ -622,17 +622,16 @@ function normalizeWheelEventDirection(evt) {
|
||||
}
|
||||
|
||||
function normalizeWheelEventDelta(evt) {
|
||||
const deltaMode = evt.deltaMode; // Avoid being affected by bug 1392460.
|
||||
let delta = normalizeWheelEventDirection(evt);
|
||||
|
||||
const MOUSE_DOM_DELTA_PIXEL_MODE = 0;
|
||||
const MOUSE_DOM_DELTA_LINE_MODE = 1;
|
||||
const MOUSE_PIXELS_PER_LINE = 30;
|
||||
const MOUSE_LINES_PER_PAGE = 30;
|
||||
|
||||
// Converts delta to per-page units
|
||||
if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
|
||||
if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
|
||||
delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
|
||||
} else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
|
||||
} else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {
|
||||
delta /= MOUSE_LINES_PER_PAGE;
|
||||
}
|
||||
return delta;
|
||||
|
Loading…
Reference in New Issue
Block a user