Skip to content

Prefer velocity over threshold for swipeable direction #222

Description

@appsforartists

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions