Add last mouse tracking to click and release events

This commit is contained in:
sigonasr2 2020-09-05 04:23:08 +09:00
parent 7f11c1a14d
commit f64b313999

View File

@ -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)) {