Promo / wheel-indicator

Indicates when user makes swipe gesture on a trackpad or mouse wheel
http://promo.github.io/wheel-indicator/
271 stars 41 forks source link

Accelerating fires two events instead of one #25

Open alvarotrigo opened 9 years ago

alvarotrigo commented 9 years ago

First of all, congratulations for the script! It seems to work quite well in general.

I found a couple of small problems, this is one of them as you can see in the video: https://vimeo.com/131253387

f0rmat1k commented 9 years ago

Hello, @alvarotrigo Can you say your browser, os version and device model? And please try to repeat bug on textarea in the bottom of http://promo.github.io/wheel-indicator/ and send here log with deltas from it.

alvarotrigo commented 9 years ago

var deltasArr = [-6,-6,-18,-12,-12,-18,-18,-18,-21,-12,-30,-9,-18,-24,-18,-30,-27,-30,-24,-114,-30,-24,-24,-24,-30,-21,-21,-27,-21,-24,-24,-21,-24,-21,-21,-21,-21,-27,-21,-24,-27,-39,-45,-42,-62,-62,-72,-66,-81,-96,-84,-51,-90,-60,-81,-57,-48,-39,-30,-27,-27,-21,-15,-12,-9,-9,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,3,-3,3,3,3,3,3,3,3,3];

Mac OS X Yosemite 10.10.3 All browsers (Chrome, Safari, Firefox....) Apple Macbook Pro

f0rmat1k commented 9 years ago

@alvarotrigo On the video looks like you did two movements, one small in begin, and then second long. It's not a bug, also we can't detect such situations.

About log. it's very strange sequence for one movement. Algorithms detected ['up', 'up', 'down']. It really was one movement?

alvarotrigo commented 9 years ago

On the video looks like you did two movements, one small in begin, and then second long. It's not a bug

It was only one movement. None stop. Slow scrolling at first and accelerating at the end.

Here you have another log:

var deltasArr = [-3,-3,-6,-3,-9,-9,-6,-12,-6,-9,-9,-9,-6,-9,-6,-6,-6,-6,-27,-9,-3,-9,-6,-6,-6,-6,-6,-6,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-6,-3,-6,-9,-9,-12,-12,-15,-21,-24,-30,-24,-33,-30,-42,-54,-36,-51,-51,-66,-62,-69,-72,-75,-78,-75,-60,-57,-62,-62,-57,-51,-51,-48,-45,-120,-27,-39,-21,-27,-18,-21,-6,-12,-15,-9,-9,-12,-6,-6,-6,-9,-6,-6,-6,-6,-3,-6,-3,-3,-3,-3,-3,-3,3,-3,-3,-3,3,-3,-3,-3,-3,3,3,3,3,3];

It enters in the isStopped condition here AND also in the is not accelerating one here.

Here you can play with it in the fiddle, you'll see in the right the delta values and a line whenever a new movement is detected when it shouldn't. http://jsfiddle.net/obLrdpLn/1/

Something like:

3
9
15
12
15
12
12
12
21
6
12
12
6
15
12
12
9
15
9
6
21
6   
3   entering in line  204   and setting  this._isAcceleration = false; ([6, 21, 6],  deltaAbs= 3)
6
3
3
3
3
3
3
3
3
3
3
6
6
12
12
21
21
30
33
48
---------- entering in line 198  and setting this._isAcceleration = true;  ([21, 30, 33],  deltaAbs=48 )
36
51
57
54
57
45
48
48
30
42
33
27
45
18
15
21
9
9
6
12
9
30
3
6
3
3
3
3
3
alvarotrigo commented 9 years ago

Sometimes even 3 scrolls were detected with a single swipe:

var deltasArr = [-3,-12,-9,-12,-12,-12,-12,-24,-24,-21,-33,-30,-234,-33,-48,-45,-42,-45,-48,-60,-45,-81,-62,-57,-54,-81,-87,-75,-81,-108,-117,-93,-117,-111,-111,-111,-60,-90,-204,-204,-204,-195,-192,-189,-183,-177,-159,-144,-135,-123,-108,-102,-90,-84,-78,-72,-62,-57,-54,-48,-45,-42,-39,-36,-33,-30,-27,-24,-24,-21,-18,-18,-15,-15,-15,-12,-12,-12,-9,-9,-6,-6,-6,-6,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3];

alvarotrigo commented 9 years ago

I attach another video where you can clearly see I'm only swiping once and how two "up" arrows are being generated in your site. http://tinypic.com/player.php?v=34orngw%3E&s=8#.VYWXmxNViko

alvarotrigo commented 9 years ago

What about using an average of the last scrolling values as a check instead of the exact value of the last 3 scrolls? (which as you saw, might lead to problems)

Take a look at the implementation of fullPage.js to see if it is accelerating or not.

f0rmat1k commented 9 years ago

@alvarotrigo hello. Sorry, but right now we don't have enough time for research the problem. Soon we will try to come back to this.

f0rmat1k commented 9 years ago

@alvarotrigo we have written new beta (works only with chrome yet). Check it out and give feedback please.

alvarotrigo commented 9 years ago

Hi @f0rmat1k , it seems it has improved for kinetic scrolling trackpads, but now it reports two scroll for normal scroll mouses when the 1st and the 2nd scroll are not very close to each other. I noticed it when scrolling normally.

hum-n commented 8 years ago

It still sometimes trigger 2 times for me too with a magic mouse.

f0rmat1k commented 8 years ago

@AntoineBoulanger Ye, there is a small chance that double event occur. But we don't know yet what to do :).