Browse Source

#185: fixed group & touch

pull/191/head
RubaXa 10 years ago
parent
commit
8ee92ddd32
  1. 20
      Sortable.js

20
Sortable.js

@ -104,9 +104,7 @@
setData: function (dataTransfer, dragEl) { setData: function (dataTransfer, dragEl) {
dataTransfer.setData('Text', dragEl.textContent); dataTransfer.setData('Text', dragEl.textContent);
} }
}, };
group = options.group;
// Set default options // Set default options
@ -115,6 +113,8 @@
} }
var group = options.group;
if (!group || typeof group != 'object') { if (!group || typeof group != 'object') {
group = options.group = { name: group }; group = options.group = { name: group };
} }
@ -286,11 +286,13 @@
_css(ghostEl, 'display', 'none'); _css(ghostEl, 'display', 'none');
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY), var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
parent = target.parentNode, parent = target && target.parentNode,
groupName = this.options.group.name, groupName = this.options.group.name,
i = touchDragOverListeners.length; i = touchDragOverListeners.length;
if (parent && (' ' + parent[expando] + ' ').indexOf(groupName) > -1) { if (parent) {
do {
if ((' ' + parent[expando] + ' ').indexOf(groupName) > -1) {
while (i--) { while (i--) {
touchDragOverListeners[i]({ touchDragOverListeners[i]({
clientX: touchEvt.clientX, clientX: touchEvt.clientX,
@ -299,6 +301,14 @@
rootEl: parent rootEl: parent
}); });
} }
break;
}
target = parent; // store last element
}
/* jshint boss:true */
while (parent = parent.parentNode);
} }
_css(ghostEl, 'display', ''); _css(ghostEl, 'display', '');

Loading…
Cancel
Save