aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2013-04-05 15:49:24 +0000
committerSimon Tatham <anakin@pobox.com>2013-04-05 15:49:24 +0000
commit7479c2882dfa7c3b75653c728ade1997734f3d01 (patch)
tree14a72c896b9031fc473e0f099a917e14092ff6be
parent33b3947d1f449335b9065736c76dc74992508cac (diff)
downloadpuzzles-7479c2882dfa7c3b75653c728ade1997734f3d01.zip
puzzles-7479c2882dfa7c3b75653c728ade1997734f3d01.tar.gz
puzzles-7479c2882dfa7c3b75653c728ade1997734f3d01.tar.bz2
puzzles-7479c2882dfa7c3b75653c728ade1997734f3d01.tar.xz
Stop accidentally subtracting onscreen_canvas.offset{Left,Top} from
the return value of relative_mouse_coords! I only got away with that error because the canvas was at offset zero compared to its immediate parent element. [originally from svn r9808]
-rw-r--r--emccpre.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/emccpre.js b/emccpre.js
index 38d7815..66e6354 100644
--- a/emccpre.js
+++ b/emccpre.js
@@ -135,9 +135,7 @@ function initPuzzle() {
buttons_down = 0;
onscreen_canvas.onmousedown = function(event) {
var xy = relative_mouse_coords(event, onscreen_canvas);
- mousedown(xy.x - onscreen_canvas.offsetLeft,
- xy.y - onscreen_canvas.offsetTop,
- event.button);
+ mousedown(xy.x, xy.y, event.button);
buttons_down |= 1 << event.button;
onscreen_canvas.setCapture(true);
};
@@ -146,9 +144,7 @@ function initPuzzle() {
onscreen_canvas.onmousemove = function(event) {
if (buttons_down) {
var xy = relative_mouse_coords(event, onscreen_canvas);
- mousemove(xy.x - onscreen_canvas.offsetLeft,
- xy.y - onscreen_canvas.offsetTop,
- buttons_down);
+ mousemove(xy.x, xy.y, buttons_down);
}
};
mouseup = Module.cwrap('mouseup', 'void',
@@ -157,9 +153,7 @@ function initPuzzle() {
if (buttons_down & (1 << event.button)) {
buttons_down ^= 1 << event.button;
var xy = relative_mouse_coords(event, onscreen_canvas);
- mouseup(xy.x - onscreen_canvas.offsetLeft,
- xy.y - onscreen_canvas.offsetTop,
- event.button);
+ mouseup(xy.x, xy.y, event.button);
}
};