From 019fc1a32b20736bbd63b450d2be2335ad34ff52 Mon Sep 17 00:00:00 2001 From: sp-kilobug Date: Tue, 6 Oct 2015 09:18:09 +0200 Subject: [PATCH] "distance" option refactored --- Sortable.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Sortable.js b/Sortable.js index 32143a8..800a74e 100644 --- a/Sortable.js +++ b/Sortable.js @@ -470,16 +470,13 @@ var touch = evt.touches ? evt.touches[0] : evt; - if (this.options.distance && this.options.distance > 0) { - // sorting will not start until mouse is dragged at a minimum distance - // this is used to prevent unwanted move during a simple click on a sortable element - if (!Sortable.active && !(Math.abs(touch.clientX - this._lastX) > this.options.distance || Math.abs(touch.clientY - this._lastY) > this.options.distance)) { - return; - } - } - // only set the status to dragging, when we are actually dragging if (!Sortable.active) { + if (this.options.distance && this.options.distance > 0) { // #590 + if (Math.abs(touch.clientX - this._lastX) < this.options.distance && Math.abs(touch.clientY - this._lastY) < this.options.distance) { + return; + } + } this._dragStarted(); }