From 4d78e80ea14db944c2ffcf7fdb9e04e6939525c2 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Mon, 3 Mar 2025 20:58:06 +0100 Subject: [PATCH] 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 --- modules/renderer/map.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/modules/renderer/map.js b/modules/renderer/map.js index a288aef41..b5d71a369 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -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);