Skip to content

Commit

Permalink
Pass on touch move events when Dragdealer isn't enabled in that direc…
Browse files Browse the repository at this point in the history
…tion #12
  • Loading branch information
ovidiuch committed Jan 16, 2014
1 parent e5f8770 commit 3f31152
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dragdealer.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ Dragdealer.prototype = {
},
onWrapperTouchMove: function(e) {
Cursor.refresh(e);
if (!this.activity && this.shouldIgnoreTouchEvent(e)) {
this.stopDrag();
return;
}
// Read comment in `onHandleTouchStart` above, to understand why we're
// preventing defaults here and not there
this.preventEventDefaults(e);
Expand Down Expand Up @@ -666,6 +670,10 @@ Dragdealer.prototype = {
unbindEventHandler: function(eventName, object) {
var eventMethod = 'on' + eventName;
object[eventMethod] = object[eventMethod]._previousHandler;
},
shouldIgnoreTouchEvent: function(e) {
return (!this.options.horizontal && Cursor.xDiff > Cursor.yDiff) ||
(!this.options.vertical && Cursor.yDiff > Cursor.xDiff);
}
};

Expand Down

0 comments on commit 3f31152

Please sign in to comment.