react-timeseries-charts icon indicating copy to clipboard operation
react-timeseries-charts copied to clipboard

Check for Firefox and, in that case, scroll faster in charts

Open dirkdevriendt opened this issue 6 years ago • 4 comments

Fixes https://github.com/esnet/react-timeseries-charts/issues/302 Reference for Firefox check: https://stackoverflow.com/a/9851769

dirkdevriendt avatar Apr 17 '19 12:04 dirkdevriendt

Is there any way to make this less Firefox dependent? Is there a more general fix to this problem? I'm not too excited about adding fixes that only address the issue in a single browser.

In other words is there a standard way to detect that scrolling will be slow instead of saying "oh, it's firefox let's scroll faster". In the future if Firefox updates its behavior here then we'll be compensating for an issue that doesn't exist any longer and will create a new bug to fix.

That said this is the real world and there may not be a cleaner fix.

jdugan1024 avatar May 30 '19 15:05 jdugan1024

Also, thanks for looking into this, it is appreciated!

jdugan1024 avatar May 30 '19 15:05 jdugan1024

I just did this quick fix in the same vain as the hard coded compensation that was already there, but apparently there is a more generic way in the form of -sadly, slightly inconsistent/magical- mouse scroll event properties (e.g. wheelDelta and deltaMode).

This SO question: https://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers points to a number of solutions, such as this Fiddle: http://jsfiddle.net/uNeBr/ or this Facebook code: https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js which seems to have inspired this library: https://www.npmjs.com/package/normalize-wheel

To clarify a bit, my understanding is that deltaMode (https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode) defines if the browser measures scrolling in pixels/lines/pages (which is the big -20X- difference to account for), while wheelDelta/deltaX and friends seem to allow for "calibration" differences.

dirkdevriendt avatar May 30 '19 16:05 dirkdevriendt

can't it be merged? pls

hp8wvvvgnj6asjm7 avatar Feb 05 '21 19:02 hp8wvvvgnj6asjm7