Skip to content

Conversation

@simonratner
Copy link
Contributor

Mousemove/touchmove events keep on firing (once per second or so) even if the pointer position is not changing. This resulted in the direction being reset to zero if one holds the mouse/finger stationary for a while. Since __checkPosition only has a two-way branch, a zero direction always fell into the second branch, resulting in sporadic broken behaviour for backwards (right, positive direction) swipes while forward (left, negative direction) swipes worked perfectly.

Specifically:

  1. Swipe backwards (right) past the snap threshold and release immediately, page changes and everything is fine.
  2. Swipe backwards (right), hold the mouse steady for a few seconds, then release. Page snaps back to its previous position (in fact, it is being advanced in the wrong direction!), page index is incremented in the wrong direction, and is now out of sync with the displayed page. Future swipes keep the page index off by one.

This is the minimal fix, it would probably make sense to also add a branch in __checkPosition to do the right thing when directionX == 0, since that could still happen when snapThreshold == 0.

Mousemove/touchmove events keep on firing (once a second or so) even if the
position is not changing. This resulted in the direction being reset to
zero if one holds the mouse/finger stationary for a while, resulting in
incorrect behaviour once the mouse/finger is released.
@simonratner
Copy link
Contributor Author

Sorry, this isn't a complete fix. I'll send a proper fix in a bit.

@cubiq
Copy link
Owner

cubiq commented Aug 25, 2012

would you integrate this into the latest version so your name appears between the collaborators? Thanks and sorry for not merging this earlier... I really haven't seen this pull request before, sorry again!

@stephanfowler
Copy link

Doesn't look like f1e1904 ever got merged.

@kpuputti
Copy link

@cubic Here's the patch by @simonratner applied to the latest repo: #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants