From d92628a43213dd0b8f96e3b383c08b9a0cc41342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 27 Jan 2016 11:38:45 +0100 Subject: [PATCH] Make click and doubleclick events work on View. --- src/view/View.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/view/View.js b/src/view/View.js index 3615676f..33810505 100644 --- a/src/view/View.js +++ b/src/view/View.js @@ -1254,20 +1254,19 @@ new function() { // Injection scope for event handling on the browser // See if we're clicking again on the same item, within the // double-click time. Firefox uses 300ms as the max time // difference: - if (item) { - dblClick = item === clickItem - && (Date.now() - clickTime < 300); - downItem = clickItem = item; - // Only start dragging if the mousedown event has not - // stopped propagation. - dragItem = !stopped && item; - } + dblClick = item === clickItem + && (Date.now() - clickTime < 300); + downItem = clickItem = item; + // Only start dragging if the mousedown event has not + // stopped propagation. + dragItem = !stopped && item; downPoint = lastPoint = point; } else if (mouse.up) { // Emulate click / doubleclick, but only on item, not view - if (!stopped && item && item === downItem) { + if (!stopped && item === downItem) { clickTime = Date.now(); - emitMouseEvent(item, dblClick ? 'doubleclick' : 'click', + emitMouseEvents(this, item, + dblClick ? 'doubleclick' : 'click', event, point, downPoint); dblClick = false; }