From 8b2a2595282e2a26e7fc117e8eb5ace09010a74e Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 16 Mar 2010 00:26:50 -0600 Subject: [PATCH] Add new event for initial mouseclick on draggable item. This reverts commit 1761e27b82c75ca1c3e8195dae152c9454958949. --- horde/js/dragdrop2.js | 12 ++++++++++-- imp/js/DimpBase.js | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/horde/js/dragdrop2.js b/horde/js/dragdrop2.js index 7ea6f5299..e685b6792 100644 --- a/horde/js/dragdrop2.js +++ b/horde/js/dragdrop2.js @@ -46,10 +46,13 @@ * Fired on mousemove. * * 'DragDrop2:end' + * Fired on mouseup. + * + * 'DragDrop2:mousedown' * Fired on mousedown. * * 'DragDrop2:start' - * Fired on mouseup. + * Fired when first moved more than 'threshold'. * * * new Drop(element, { @@ -263,9 +266,11 @@ Drag = Class.create({ DragDrop.Drags.activate(this); this.move = 0; this.wasDragged = false; + this.wasMoved = false; this.lastcaption = null; + this.clickEvent = e; - this.element.fire('DragDrop2:start', e); + this.element.fire('DragDrop2:mousedown', e); if (this.options.ghosting || this.options.caption) { if (!DragDrop.Drags.cover) { @@ -305,6 +310,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() ]; diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index 2a10dc4e7..9fbfce370 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -1607,7 +1607,7 @@ var DimpBase = { return cnt + ' ' + (cnt == 1 ? DIMP.text.message : DIMP.text.messages); }, - onDragStart: function(e) + onDragMouseDown: function(e) { var args, elt = e.element(), @@ -3077,7 +3077,7 @@ DimpBase._folderDropConfig = { document.observe('DragDrop2:drag', DimpBase.onDrag.bindAsEventListener(DimpBase)); document.observe('DragDrop2:drop', DimpBase.folderDropHandler.bindAsEventListener(DimpBase)); document.observe('DragDrop2:end', DimpBase.onDragEnd.bindAsEventListener(DimpBase)); -document.observe('DragDrop2:start', DimpBase.onDragStart.bindAsEventListener(DimpBase)); +document.observe('DragDrop2:mousedown', DimpBase.onDragMouseDown.bindAsEventListener(DimpBase)); /* Route AJAX responses through ViewPort. */ DimpCore.onDoActionComplete = function(r) { -- 2.11.0