Browse Source

"distance" option refactored

pull/590/head
sp-kilobug 9 years ago
parent
commit
019fc1a32b
  1. 11
      Sortable.js

11
Sortable.js

@ -470,16 +470,13 @@
var touch = evt.touches ? evt.touches[0] : evt; var touch = evt.touches ? evt.touches[0] : evt;
if (this.options.distance && this.options.distance > 0) { // only set the status to dragging, when we are actually dragging
// sorting will not start until mouse is dragged at a minimum distance if (!Sortable.active) {
// this is used to prevent unwanted move during a simple click on a sortable element if (this.options.distance && this.options.distance > 0) { // #590
if (!Sortable.active && !(Math.abs(touch.clientX - this._lastX) > this.options.distance || Math.abs(touch.clientY - this._lastY) > this.options.distance)) { if (Math.abs(touch.clientX - this._lastX) < this.options.distance && Math.abs(touch.clientY - this._lastY) < this.options.distance) {
return; return;
} }
} }
// only set the status to dragging, when we are actually dragging
if (!Sortable.active) {
this._dragStarted(); this._dragStarted();
} }

Loading…
Cancel
Save