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

Prefer velocity over threshold for swipeable direction #222

Open
appsforartists opened this issue May 18, 2017 · 0 comments
Open

Prefer velocity over threshold for swipeable direction #222

appsforartists opened this issue May 18, 2017 · 0 comments

Comments

@appsforartists
Copy link
Member

appsforartists commented May 18, 2017

Right now, there's not an easy way to get direction from a velocity - you have to drag an element by a certain distance. We should support this.

Maybe something like:

const whenEnded$ = recognitionState.whenIs(ENDED);
whenEnded$.rewriteToFirst(
  drag$.velocityWhen(whenEnded$).hasMagnitudeOfAtLeast(3).toThreshold(),
  drag$.slidingThreshold(56)
).subscribe(
  direction
);

which would filter velocity to be of at least a particular magnitude, then convert it to a ThresholdSide, and fallback to positional detection if the velocity isn't high enough.

@appsforartists appsforartists changed the title Prefer velocity over threshold for tossable direction Prefer velocity over threshold for swipeable direction Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant