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

Only fire slip:swipe or slip:cancelswipe, not both #70

Closed carter-thaxton closed 8 years ago

carter-thaxton commented 8 years ago

Previously, if you called e.preventDefault() in a slip:swipe handler, in addition to animating the element back to zero, it would also call slip:cancelswipe. However, this is unintuitive, and error-prone for most uses. It seems to me that after slip:beforeswipe, only one of slip:swipe or slip:cancelswipe should be fired. There was no way to know that slip:cancelswipe was being fired for this reason, and not because it was actually cancelled (i.e. the user let go without actually swiping left or right).

Until making this fix, I had to add some ugly workarounds and flags in all my code that used slip.js and depended on the slip:cancelswipe event.

kornelski commented 8 years ago

Makes sense. Thanks.