Skip to content

Commit

Permalink
Merge pull request #85 from bhollis/patch-1
Browse files Browse the repository at this point in the history
Search upwards for a draggable element in touchstartDelay
  • Loading branch information
xStrom authored Mar 6, 2017
2 parents 006e62d + 9638afe commit 81db0db
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions ios-drag-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,30 @@ function _exposeIosHtml5DragDropShim(config) {
return function(evt){
var el = evt.target;

if (el.draggable === true) {
var heldItem = function() {
end.off();
cancel.off();
scroll.off();
touchstart(evt);
};

var onReleasedItem = function() {
end.off();
cancel.off();
scroll.off();
clearTimeout(timer);
};

var timer = setTimeout(heldItem, delay);

var end = onEvt(el, 'touchend', onReleasedItem, this);
var cancel = onEvt(el, 'touchcancel', onReleasedItem, this);
var scroll = onEvt(window, 'scroll', onReleasedItem, this);
}
do {
if (el.draggable === true) {
var heldItem = function() {
end.off();
cancel.off();
scroll.off();
touchstart(evt);
};

var onReleasedItem = function() {
end.off();
cancel.off();
scroll.off();
clearTimeout(timer);
};

var timer = setTimeout(heldItem, delay);

var end = onEvt(el, 'touchend', onReleasedItem, this);
var cancel = onEvt(el, 'touchcancel', onReleasedItem, this);
var scroll = onEvt(window, 'scroll', onReleasedItem, this);
break;
}
} while ((el = el.parentNode) && el !== doc.body);
};
};

Expand Down

0 comments on commit 81db0db

Please sign in to comment.