Input.activePointer position returns (-1, -1)
notaduck448 opened this issue · comments
I'm trying to get the position of the mouse pointer relative to the screen, but when I do PhaserGame.input.activePointer.clientX
or PhaserGame.input.activePointer.clientY
, they both return -1, regardless of actual mouse position.
This isn't just the case for clientX
or clientY
. pageX
and pageY
, and x
and y
return -1 as well.
I just noticed that screenX
and screenY
are also -1. Weird
Use game.debug.inputInfo(…)
or game.debug.pointer(…)
.
Try with no other HTML elements on the page, no CSS, no game parent.
What does this.game.debug.inputInfo(…)
show?
Verify (in a scene callback)
this.game === PhaserGame
X, Y: both 0
World X, Y: both change based on character position, don't change when moving mouse
Scale X, Y: both 1.0
Screen X, Y: both -1
also important to note that button input (e.g. mousePointer.isDown returns false when the mouse button really is down) does not work either.
However, this.game.input.mousePointer.active returns true
this.game === PhaserGame returns true
Nevermind I fixed it, I had to manually set the hitCanvas property of the input object.