mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
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]
This commit is contained in:
12
emccpre.js
12
emccpre.js
@ -135,9 +135,7 @@ function initPuzzle() {
|
|||||||
buttons_down = 0;
|
buttons_down = 0;
|
||||||
onscreen_canvas.onmousedown = function(event) {
|
onscreen_canvas.onmousedown = function(event) {
|
||||||
var xy = relative_mouse_coords(event, onscreen_canvas);
|
var xy = relative_mouse_coords(event, onscreen_canvas);
|
||||||
mousedown(xy.x - onscreen_canvas.offsetLeft,
|
mousedown(xy.x, xy.y, event.button);
|
||||||
xy.y - onscreen_canvas.offsetTop,
|
|
||||||
event.button);
|
|
||||||
buttons_down |= 1 << event.button;
|
buttons_down |= 1 << event.button;
|
||||||
onscreen_canvas.setCapture(true);
|
onscreen_canvas.setCapture(true);
|
||||||
};
|
};
|
||||||
@ -146,9 +144,7 @@ function initPuzzle() {
|
|||||||
onscreen_canvas.onmousemove = function(event) {
|
onscreen_canvas.onmousemove = function(event) {
|
||||||
if (buttons_down) {
|
if (buttons_down) {
|
||||||
var xy = relative_mouse_coords(event, onscreen_canvas);
|
var xy = relative_mouse_coords(event, onscreen_canvas);
|
||||||
mousemove(xy.x - onscreen_canvas.offsetLeft,
|
mousemove(xy.x, xy.y, buttons_down);
|
||||||
xy.y - onscreen_canvas.offsetTop,
|
|
||||||
buttons_down);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mouseup = Module.cwrap('mouseup', 'void',
|
mouseup = Module.cwrap('mouseup', 'void',
|
||||||
@ -157,9 +153,7 @@ function initPuzzle() {
|
|||||||
if (buttons_down & (1 << event.button)) {
|
if (buttons_down & (1 << event.button)) {
|
||||||
buttons_down ^= 1 << event.button;
|
buttons_down ^= 1 << event.button;
|
||||||
var xy = relative_mouse_coords(event, onscreen_canvas);
|
var xy = relative_mouse_coords(event, onscreen_canvas);
|
||||||
mouseup(xy.x - onscreen_canvas.offsetLeft,
|
mouseup(xy.x, xy.y, event.button);
|
||||||
xy.y - onscreen_canvas.offsetTop,
|
|
||||||
event.button);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user