Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwipeMoveEvent distance: value is absolute #235

Open
doctorj opened this issue Nov 29, 2014 · 0 comments
Open

SwipeMoveEvent distance: value is absolute #235

doctorj opened this issue Nov 29, 2014 · 0 comments

Comments

@doctorj
Copy link

doctorj commented Nov 29, 2014

In SwipeRecognizer distance is calculated like this:

lastDistance = Math.abs(touch.getPageX() - x);

So, it is absolute value of difference between current position and position at swipe start.
My usecase:
Swipe direction is LEFT_TO_RIGHT. When I start swipeing to the right, SwipeMoveEvents are fired with distance increasing. I use that value to set left property of list item. Now, if I start moving back to the left and pass point where swipe started, because distance is calculated as absolute value, it looks like I'm moving to the right (see image below).
swipe
So, at the moment we can have SwipeMoveEvent fired with same distance value from two different positions.
What do you think, is it ok for distance to be negative then?

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

No branches or pull requests

1 participant