Browse Source

#185: fixed group & touch

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

34
Sortable.js

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

Loading…
Cancel
Save