From 6ffdfd3aa74ad0338df5a05be9383a22dde1198b Mon Sep 17 00:00:00 2001
From: Pierre Ossman <ossman@cendio.se>
Date: Thu, 9 Feb 2017 16:02:58 +0100
Subject: [PATCH] Improve check for when to ignore mouse events

The browser tells us which element was under the cursor, so we don't
have to calculate it ourselves.
---
 core/input/devices.js | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/core/input/devices.js b/core/input/devices.js
index c2cdb2c..e38f9c7 100644
--- a/core/input/devices.js
+++ b/core/input/devices.js
@@ -330,12 +330,8 @@
             if (!this._focused) { return true; }
 
             var evt = (e ? e : window.event);
-            var pos = Util.getEventPosition(e, this._target, this._scale);
-
             /* Stop propagation if inside canvas area */
-            if ((pos.realx >= 0) && (pos.realy >= 0) &&
-                (pos.realx < this._target.offsetWidth) &&
-                (pos.realy < this._target.offsetHeight)) {
+            if (evt.target == this._target) {
                 //Util.Debug("mouse event disabled");
                 Util.stopEvent(e);
                 return false;
-- 
GitLab