phaserjs / phaser-ce-examples

Contains hundreds of source code examples and related media for the Phaser HTML5 Game Framework.

Home Page:http://phaser.io/examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pointer lock in Firefox breaking with mousedown events

burntcustard opened this issue · comments

commented

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?

PR? :)