phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Home Page:http://phaser.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

screenshot 31 _li

I just noticed that screenX and screenY are also -1. Weird

commented

Use game.debug.inputInfo(…) or game.debug.pointer(…).

Try with no other HTML elements on the page, no CSS, no game parent.

commented

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

This is all I get.

capture

Normal DOM events (such as jQuery .click) are working.

Nevermind I fixed it, I had to manually set the hitCanvas property of the input object.