From e302429d7c7d82d26a6c6802d48b84f770756842 Mon Sep 17 00:00:00 2001 From: Carlos Alberto Lopez Perez Date: Tue, 16 Dec 2014 18:26:52 +0100 Subject: [PATCH] Check for mouse events also on touch devices --- js/Graph.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/js/Graph.js b/js/Graph.js index faaa33a6..deafd217 100644 --- a/js/Graph.js +++ b/js/Graph.js @@ -553,16 +553,17 @@ Graph.prototype = { } this.lastMousePos = pos; }, this)); - - } else { - this. - observe(this.overlay, 'mousedown', _.bind(this.mouseDownHandler, this)). - observe(el, 'mousemove', _.bind(this.mouseMoveHandler, this)). - observe(this.overlay, 'click', _.bind(this.clickHandler, this)). - observe(el, 'mouseout', function (e) { - E.fire(el, 'flotr:mouseout', e); - }); } + + // We should do this both for mouse-driven and touch devices. + // The user can use a mouse even if her device has touch capabilities. + this. + observe(this.overlay, 'mousedown', _.bind(this.mouseDownHandler, this)). + observe(el, 'mousemove', _.bind(this.mouseMoveHandler, this)). + observe(this.overlay, 'click', _.bind(this.clickHandler, this)). + observe(el, 'mouseout', function (e) { + E.fire(el, 'flotr:mouseout', e); + }); }, /**