Add last mouse tracking to click and release events
This commit is contained in:
parent
7f11c1a14d
commit
f64b313999
6
game.js
6
game.js
@ -786,6 +786,9 @@ function clickEvent(e) {
|
|||||||
} else {
|
} else {
|
||||||
MOBILE=false
|
MOBILE=false
|
||||||
}
|
}
|
||||||
|
var mousepos = getMousePos(e)
|
||||||
|
LAST_MOUSE_X=mousepos.x
|
||||||
|
LAST_MOUSE_Y=mousepos.y
|
||||||
|
|
||||||
if (gameState===STARTUP) {
|
if (gameState===STARTUP) {
|
||||||
currentSound.play()
|
currentSound.play()
|
||||||
@ -885,6 +888,9 @@ function releaseEvent(e) {
|
|||||||
if (e instanceof TouchEvent) {
|
if (e instanceof TouchEvent) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
|
var mousepos = getMousePos(e)
|
||||||
|
LAST_MOUSE_X=mousepos.x
|
||||||
|
LAST_MOUSE_Y=mousepos.y
|
||||||
if (SUBMENU.visible) {
|
if (SUBMENU.visible) {
|
||||||
for (var button of SUBMENU.buttons) {
|
for (var button of SUBMENU.buttons) {
|
||||||
if (mouseOverButton(canvas,e,button)) {
|
if (mouseOverButton(canvas,e,button)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user