d4nyll / lethargy

Distinguish between scroll events initiated by the user, and those by inertial scrolling
http://d4nyll.github.io/lethargy/
MIT License
556 stars 47 forks source link

Slow scrolling desktop mouse events marked as inertial #14

Open renarsvilnis opened 7 years ago

renarsvilnis commented 7 years ago

Hi, I came across an issue when using default settings and desktop mouse. If I scroll slowly on with mouse wheel, these events are marked as inertial.

Even if I switch scroll direction to opposite, it continues to be detected as inertial (lethargy.check(ev) === false).

p.s. I'm using a modified version of the jsfiddle demo from README.md. I added lethargy with default settings and differentiate inertial events by coloring them red and normal events as gray.

screen shot 2017-02-10 at 06 06 53
d4nyll commented 7 years ago

Hi @renarsvilnis thank you very much for sharing your experience. I am not sure I understand you 100%, so I'll provide multiple responses, let me know if I hit the mark with any of them.

  1. Lethargy aims to fire scroll intents, which means for a single slow scroll, it should only fire one intent at the beginning. See the screenshot below of my desktop mouse (red is normal, gray is inertial here) slow-scroll I can't see clearly whether this is the case from your screenshot. If it is, then that's intended behaviour.
  2. Your desktop mouse has two different delta values, which I have not encountered before. You might want to try a large tolerance value (e.g. 1). If you expect your users to scroll quickly and want to register each one as an intent, you might want to try a low delay value (e.g. 50). For example, your options might look like const lethargy = new Lethargy(6,100,1,50);. See this jsFiddle.
  3. I would be very grateful if you can play around with the variables and let me know if any of them works for you. I only have a limited set of devices to test with. You can find explanation of the variables in the comments in the code
MeRahulAhire commented 1 year ago

download

@d4nyll If I scroll with force on my mousewheel it gets scrolled in opposite direction which is something you can see on the right half of this image. On trackpad its working fine (left half). Any suggestion on how to improve it?