Skip to content

Commit

Permalink
Issue SortableJS#659 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Xom9lk authored and Emile Bergeron committed Dec 15, 2016
1 parent 451e4f8 commit ea82528
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 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
25 changes: 15 additions & 10 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,15 @@
// 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);
_on(ownerDocument, 'pointermove', _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);
_on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
}, 0);

_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
} else {
Expand All @@ -434,6 +437,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 @@ -463,11 +467,11 @@
}

try {
if (document.selection) {
// Timeout neccessary for IE9
if (document.selection) {
// Timeout neccessary for IE9
setTimeout(function () {
document.selection.empty();
});
});
} else {
window.getSelection().removeAllRanges();
}
Expand Down Expand Up @@ -829,6 +833,7 @@
clearInterval(this._loopId);
clearInterval(autoScroll.pid);
clearTimeout(this._dragStartTimer);
clearTimeout(this._mousemoveFixTimer);

// Unbind events
_off(document, 'mousemove', this._onTouchMove);
Expand Down Expand Up @@ -910,7 +915,7 @@
this._nulling();
},

_nulling: function() {
_nulling: function () {
rootEl =
dragEl =
parentEl =
Expand Down
Loading

0 comments on commit ea82528

Please sign in to comment.