kornelski / slip

Slip.js — UI library for manipulating lists via swipe and drag gestures
BSD 2-Clause "Simplified" License
2.44k stars 213 forks source link

Feature: additional funtionality #56

Closed darrynten closed 9 years ago

darrynten commented 9 years ago

Return directionX and directionY in the getAbsoluteMovement() method.

Return the x and y direction with beforeswipe. Enables developers to make better decisions when receiving this event.

Refactored swipe event with a much simpler velocity calculation.

Use the direction from the new getAbsoluteMovement() method instead of recalculating in the swipe event. Fixes a bug where the direction for a right swipe would sometimes be reported as a left swipe. This was due to the direction calculation that has now been replaced in the swipe event's onEnd method.

Ability to define a "keep swiping" trigger point to be passed in to the constructor that lets you set a percentage (in terms of how far out the left- or rightmost edge of the list item has moved across the width of the list) that will trigger a swipe regardless of velocity. This allows a user to swipe out past x percent, think for a while, and if they still want it to swipe out let go and have it swipe out if past the minimum percent. Makes the swiping gestures behave more like they do in native Android applications.

The default value for swipe percent is 0 if it is missing, which returns false for the check.

Fixed a bug with the assignment of options in the constructor.

Configurable velocity and time for swipe with defaults for when these configurable options are not present which match the original settings.

darrynten commented 9 years ago

Resolves #42

mauron85 commented 9 years ago

Looking great. +1

kornelski commented 9 years ago

Cool! Thanks.

darrynten commented 9 years ago

Happy to help. We may have some more improvements to submit in the future. Thanks for the great library.