|
|
@ -165,20 +165,27 @@ |
|
|
|
constructor: Sortable, |
|
|
|
constructor: Sortable, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_applyEffects: function () { |
|
|
|
_dragStarted: function () { |
|
|
|
|
|
|
|
// Apply effect
|
|
|
|
_toggleClass(dragEl, this.options.ghostClass, true); |
|
|
|
_toggleClass(dragEl, this.options.ghostClass, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.active = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Drag start event
|
|
|
|
|
|
|
|
_dispatchEvent(rootEl, 'start', dragEl, rootEl, startIndex); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onTapStart: function (/**Event|TouchEvent*/evt) { |
|
|
|
_onTapStart: function (/**Event|TouchEvent*/evt) { |
|
|
|
var touch = evt.touches && evt.touches[0], |
|
|
|
var type = evt.type, |
|
|
|
|
|
|
|
touch = evt.touches && evt.touches[0], |
|
|
|
target = (touch || evt).target, |
|
|
|
target = (touch || evt).target, |
|
|
|
originalTarget = target, |
|
|
|
originalTarget = target, |
|
|
|
options = this.options, |
|
|
|
options = this.options, |
|
|
|
el = this.el, |
|
|
|
el = this.el, |
|
|
|
filter = options.filter; |
|
|
|
filter = options.filter; |
|
|
|
|
|
|
|
|
|
|
|
if (evt.type === 'mousedown' && evt.button !== 0 || options.disabled) { |
|
|
|
if (type === 'mousedown' && evt.button !== 0 || options.disabled) { |
|
|
|
return; // only left button or enabled
|
|
|
|
return; // only left button or enabled
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -215,14 +222,11 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// IE 9 Support
|
|
|
|
// Prepare `dragstart`
|
|
|
|
if (target && evt.type == 'selectstart') { |
|
|
|
|
|
|
|
if (target.tagName != 'A' && target.tagName != 'IMG') { |
|
|
|
|
|
|
|
target.dragDrop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (target && !dragEl && (target.parentNode === el)) { |
|
|
|
if (target && !dragEl && (target.parentNode === el)) { |
|
|
|
|
|
|
|
// IE 9 Support
|
|
|
|
|
|
|
|
(type === 'selectstart') && target.dragDrop(); |
|
|
|
|
|
|
|
|
|
|
|
tapEvt = evt; |
|
|
|
tapEvt = evt; |
|
|
|
|
|
|
|
|
|
|
|
rootEl = this.el; |
|
|
|
rootEl = this.el; |
|
|
@ -269,17 +273,11 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Drag start event
|
|
|
|
|
|
|
|
_dispatchEvent(rootEl, 'start', dragEl, rootEl, startIndex); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
if (activeGroup.pull == 'clone') { |
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
cloneEl = dragEl.cloneNode(true); |
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Sortable.active = this; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -370,8 +368,6 @@ |
|
|
|
_on(document, 'drop', this); |
|
|
|
_on(document, 'drop', this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(this._applyEffects, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scrollEl = options.scroll; |
|
|
|
scrollEl = options.scroll; |
|
|
|
|
|
|
|
|
|
|
|
if (scrollEl === true) { |
|
|
|
if (scrollEl === true) { |
|
|
@ -386,6 +382,8 @@ |
|
|
|
/* jshint boss:true */ |
|
|
|
/* jshint boss:true */ |
|
|
|
} while (scrollEl = scrollEl.parentNode); |
|
|
|
} while (scrollEl = scrollEl.parentNode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(this._dragStarted, 0); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_onDrag: _throttle(function (/**Event*/evt) { |
|
|
|
_onDrag: _throttle(function (/**Event*/evt) { |
|
|
@ -621,7 +619,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Drag end event
|
|
|
|
// Drag end event
|
|
|
|
_dispatchEvent(rootEl, 'end', dragEl, rootEl, startIndex, newIndex); |
|
|
|
Sortable.active && _dispatchEvent(rootEl, 'end', dragEl, rootEl, startIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Set NULL
|
|
|
|
// Set NULL
|
|
|
|