phaserjs / phaser-ce-examples

Contains hundreds of source code examples and related media for the Phaser HTML5 Game Framework.
http://phaser.io/examples
1.76k stars 1.15k forks source link

Pointer lock in Firefox breaking with mousedown events #163

Closed burntcustard closed 7 years ago

burntcustard commented 7 years ago

There seems to be an issue with the pointer lock in Phaser in Firefox (tested on 53), where the cursor will jump around when mouse buttons are pressed.

It's noticable, at least for me, in the pointer lock example, where the ball sprite just disappears if any of my 3 main mouse buttons are pressed.

In the demo on the MDN page about pointer lock, it seems to work fine, although from what I can tell, they are only tracking mousemove events, and not ALL mouse events.

In my own game, I've used this line from the Phaser example: if (game.input.mouse.locked) but I've also added a check to see what type of event's going on: if (game.input.mouse.locked && game.input.mouse.event.type !== "mousedown") This stops mousedown events from interfering with my sprite-moving code, and it seems to fix the Phaser example as well. So I think either that should be added to the example, or the way Phaser handles these events could be investigated further?

photonstorm commented 7 years ago

PR? :)

photonstorm commented 7 years ago

👍