Skip to content

Commit

Permalink
Issue SortableJS#659 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Xom9lk committed Jul 15, 2016
1 parent a4d5aa1 commit 6228a4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
.idea
mock.png
.*.sw*
.build*
Expand Down
15 changes: 10 additions & 5 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,14 @@
// If the user moves the pointer or let go the click or touch
// before the delay has been reached:
// disable the delayed drag
_on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
_on(ownerDocument, 'touchend', _this._disableDelayedDrag);
_on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
_on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
_on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
// timeout fix issue #659
this._mousemoveFixTimer = setTimeout(function () {
_on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
_on(ownerDocument, 'touchend', _this._disableDelayedDrag);
_on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
_on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
_on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
}, 0);

_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
} else {
Expand All @@ -374,6 +377,7 @@
var ownerDocument = this.el.ownerDocument;

clearTimeout(this._dragStartTimer);
clearTimeout(this._mousemoveFixTimer);
_off(ownerDocument, 'mouseup', this._disableDelayedDrag);
_off(ownerDocument, 'touchend', this._disableDelayedDrag);
_off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
Expand Down Expand Up @@ -744,6 +748,7 @@
clearInterval(this._loopId);
clearInterval(autoScroll.pid);
clearTimeout(this._dragStartTimer);
clearTimeout(this._mousemoveFixTimer);

// Unbind events
_off(document, 'mousemove', this._onTouchMove);
Expand Down
Loading

0 comments on commit 6228a4a

Please sign in to comment.