From 45707c39dd99834e4a60872e26f61c2fdca8657f Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 15 Mar 2010 17:32:18 +0100 Subject: [PATCH] Fire DragDrop2:start only after moving the mouse more than the defined threshold. --- horde/js/dragdrop2.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/horde/js/dragdrop2.js b/horde/js/dragdrop2.js index 7ea6f5299..f1c37369e 100644 --- a/horde/js/dragdrop2.js +++ b/horde/js/dragdrop2.js @@ -46,10 +46,10 @@ * Fired on mousemove. * * 'DragDrop2:end' - * Fired on mousedown. + * Fired on mouseup. * * 'DragDrop2:start' - * Fired on mouseup. + * Fired when first moved more than 'threshold'. * * * new Drop(element, { @@ -263,9 +263,9 @@ Drag = Class.create({ DragDrop.Drags.activate(this); this.move = 0; this.wasDragged = false; + this.wasMoved = false; this.lastcaption = null; - - this.element.fire('DragDrop2:start', e); + this.clickEvent = e; if (this.options.ghosting || this.options.caption) { if (!DragDrop.Drags.cover) { @@ -305,6 +305,9 @@ Drag = Class.create({ if (++this.move <= this.options.threshold) { return; + } else if (!this.wasMoved) { + this.element.fire('DragDrop2:start', this.clickEvent); + this.wasMoved = true; } this.lastCoord = xy = [ e.pointerX(), e.pointerY() ]; -- 2.11.0