Skip to content

Commit

Permalink
Allow click events for touch devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwild committed Jun 4, 2015
1 parent 54fc87c commit 85d666c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
tapEvt,
touchEvt,

moved,

/** @const */
RSPACE = /\s+/g,

Expand Down Expand Up @@ -427,6 +429,8 @@
dy = touch.clientY - tapEvt.clientY,
translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';

moved = true;

touchEvt = touch;

_css(ghostEl, 'webkitTransform', translate3d);
Expand Down Expand Up @@ -514,6 +518,8 @@
!options.dragoverBubble && evt.stopPropagation();
}

moved = true;

if (activeGroup && !options.disabled &&
(isOwner
? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
Expand Down Expand Up @@ -666,8 +672,10 @@
this._offUpEvents();

if (evt) {
evt.preventDefault();
!options.dropBubble && evt.stopPropagation();
if (moved) {
evt.preventDefault();
!options.dropBubble && evt.stopPropagation();
}

ghostEl && ghostEl.parentNode.removeChild(ghostEl);

Expand Down Expand Up @@ -726,6 +734,8 @@
tapEvt =
touchEvt =

moved =

lastEl =
lastCSS =

Expand Down

0 comments on commit 85d666c

Please sign in to comment.