Browse Source

Allow click events for touch devices

pull/411/head
Alex Wild 10 years ago
parent
commit
9940598312
  1. 14
      Sortable.js

14
Sortable.js

@ -45,6 +45,8 @@
tapEvt, tapEvt,
touchEvt, touchEvt,
moved,
/** @const */ /** @const */
RSPACE = /\s+/g, RSPACE = /\s+/g,
@ -427,6 +429,8 @@
dy = touch.clientY - tapEvt.clientY, dy = touch.clientY - tapEvt.clientY,
translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)'; translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
moved = true;
touchEvt = touch; touchEvt = touch;
_css(ghostEl, 'webkitTransform', translate3d); _css(ghostEl, 'webkitTransform', translate3d);
@ -514,6 +518,8 @@
!options.dragoverBubble && evt.stopPropagation(); !options.dragoverBubble && evt.stopPropagation();
} }
moved = true;
if (activeGroup && !options.disabled && if (activeGroup && !options.disabled &&
(isOwner (isOwner
? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
@ -666,8 +672,10 @@
this._offUpEvents(); this._offUpEvents();
if (evt) { if (evt) {
evt.preventDefault(); if (moved) {
!options.dropBubble && evt.stopPropagation(); evt.preventDefault();
!options.dropBubble && evt.stopPropagation();
}
ghostEl && ghostEl.parentNode.removeChild(ghostEl); ghostEl && ghostEl.parentNode.removeChild(ghostEl);
@ -726,6 +734,8 @@
tapEvt = tapEvt =
touchEvt = touchEvt =
moved =
lastEl = lastEl =
lastCSS = lastCSS =

Loading…
Cancel
Save