From 56a0e9e4fad31bc4940d6aa0e74d020fbcffe800 Mon Sep 17 00:00:00 2001 From: Koji Nakamaru Date: Mon, 26 May 2014 23:43:42 +0900 Subject: [PATCH] fixed event handling for firefox. --- tmpl/js/test-html5.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tmpl/js/test-html5.js b/tmpl/js/test-html5.js index 7ac5946..ecc8bce 100644 --- a/tmpl/js/test-html5.js +++ b/tmpl/js/test-html5.js @@ -468,13 +468,12 @@ x = t.pageX; y = t.pageY; } else { - x = e.offsetX; - y = e.offsetY; - } - if (isMobile) { - x -= stage.offsetLeft; - y -= stage.offsetTop; + x = e.clientX; + y = e.clientY; } + var r = stage.getBoundingClientRect(); + x -= r.left; + y -= r.top; x /= stage_scale; y /= stage_scale; lwf.inputPoint(x, y); @@ -492,13 +491,12 @@ x = t.pageX; y = t.pageY; } else { - x = e.offsetX; - y = e.offsetY; - } - if (isMobile) { - x -= stage.offsetLeft; - y -= stage.offsetTop; + x = e.clientX; + y = e.clientY; } + var r = stage.getBoundingClientRect(); + x -= r.left; + y -= r.top; x /= stage_scale; y /= stage_scale; lwf.inputPoint(x, y);