From 2218ca31f6c33e3428d768d13195635f58d869f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 17 Dec 2012 22:22:58 +0100 Subject: [PATCH] Fix support for double-click events. Closes #90. --- src/ui/CanvasView.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/CanvasView.js b/src/ui/CanvasView.js index d136c340..b94231f3 100644 --- a/src/ui/CanvasView.js +++ b/src/ui/CanvasView.js @@ -72,6 +72,7 @@ var CanvasView = View.extend(/** @lends CanvasView# */{ lastPoint, overPoint, downItem, + lastItem, overItem, hasDrag, doubleClick, @@ -122,8 +123,8 @@ var CanvasView = View.extend(/** @lends CanvasView# */{ var item = handleEvent(this, 'mousedown', event, point); // See if we're clicking again on the same item, within the // double-click time. Firefox uses 300ms as the max time difference: - doubleClick = downItem == item && Date.now() - clickTime < 300; - downItem = item; + doubleClick = lastItem == item && (Date.now() - clickTime < 300); + downItem = lastItem = item; downPoint = lastPoint = overPoint = point; hasDrag = downItem && downItem.responds('mousedrag'); },