fix scrolling glitch in Firefox on Windows and Linux/Xorg

For some elements, Firefox reports wheel deltas measured in lines (see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode), which we need to convert to pixels. The previous routine hugely overestimated the conversion factor if the deltaY as slightly bigger (not sure where the exp function came from originally, it does not make much sense IMO).
The lines-to-pixels factor does not seem to be quite consistent between different Firefox builds, but this compromise factor should be good enough, I hope.

PS: Firefox on Mac OS does not report deltas as lines anymore it seems.

closes #10825
This commit is contained in:
Martin Raifer
2025-03-03 20:58:06 +01:00
parent d98f04a297
commit 4d78e80ea1

View File

@@ -496,18 +496,11 @@ export function rendererMap(context) {
var lines = Math.abs(source.deltaY);
var sign = (source.deltaY > 0) ? 1 : -1;
dY = sign * clamp(
Math.exp((lines - 1) * 0.75) * 4.000244140625,
lines * 18.001,
4.000244140625, // min
350.000244140625 // max
);
// On Firefox Windows and Linux we always get +/- the scroll line amount (default 3)
// There doesn't seem to be any scroll acceleration.
// This multiplier increases the speed a little bit - #5512
if (detected.os !== 'mac') {
dY *= 5;
}
// recalculate x2,y2,k2
t0 = _isTransformed ? _transformLast : _transformStart;
p0 = _getMouseCoords(source);