Skip to content

Commit d1e6026

Browse files
committed
+ supportPointer (low level api)
1 parent 811e448 commit d1e6026

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ mock.png
33
.*.sw*
44
.build*
55
jquery.fn.*
6+
.idea/

Sortable.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@
275275
fallbackClass: 'sortable-fallback',
276276
fallbackOnBody: false,
277277
fallbackTolerance: 0,
278-
fallbackOffset: {x: 0, y: 0}
278+
fallbackOffset: {x: 0, y: 0},
279+
supportPointer: Sortable.supportPointer !== false,
279280
};
280281

281282

@@ -299,7 +300,7 @@
299300
// Bind events
300301
_on(el, 'mousedown', this._onTapStart);
301302
_on(el, 'touchstart', this._onTapStart);
302-
_on(el, 'pointerdown', this._onTapStart);
303+
options.supportPointer && _on(el, 'pointerdown', this._onTapStart);
303304

304305
if (this.nativeDraggable) {
305306
_on(el, 'dragover', this);
@@ -440,8 +441,8 @@
440441
_on(ownerDocument, 'mouseup', _this._onDrop);
441442
_on(ownerDocument, 'touchend', _this._onDrop);
442443
_on(ownerDocument, 'touchcancel', _this._onDrop);
443-
_on(ownerDocument, 'pointercancel', _this._onDrop);
444444
_on(ownerDocument, 'selectstart', _this);
445+
options.supportPointer && _on(ownerDocument, 'pointercancel', _this._onDrop);
445446

446447
if (options.delay) {
447448
// If the user moves the pointer or let go the click or touch
@@ -452,7 +453,7 @@
452453
_on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
453454
_on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
454455
_on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
455-
_on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
456+
options.supportPointer && _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
456457

457458
_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
458459
} else {
@@ -674,8 +675,11 @@
674675
_on(document, 'touchmove', _this._onTouchMove);
675676
_on(document, 'touchend', _this._onDrop);
676677
_on(document, 'touchcancel', _this._onDrop);
677-
_on(document, 'pointermove', _this._onTouchMove);
678-
_on(document, 'pointerup', _this._onDrop);
678+
679+
if (options.supportPointer) {
680+
_on(document, 'pointermove', _this._onTouchMove);
681+
_on(document, 'pointerup', _this._onDrop);
682+
}
679683
} else {
680684
// Old brwoser
681685
_on(document, 'mousemove', _this._onTouchMove);

0 commit comments

Comments
 (0)