Pc.mouse.isPressed(pc.MOUSEBUTTON_LEFT) is incorrectly true after going full screen

Preview:

http://playcanv.as/e/p/qsalmvrX

Project:

https://playcanvas.com/project/388136

To reproduce this issue, click anywhere in the canvas area.

Notice at the top that pc.mouse.isPressed(pc.MOUSEBUTTON_LEFT) is still true after going full screen.

This reproduces for me on my first person WebVR game where clicking the screen will make it go full screen. In my game, the left mouse button makes you move forward, and I detect mouse buttons using pc.mouse.isPressed. This causes the character to continually move forward until the user clicks the left mouse button again.

Is there a workaround or fix to this? Is there a way to manually set pc.mouse.isPressed(pc.MOUSEBUTTON_LEFT) to false?

Thank you!

Weird,

I have repeated that here. I guess the request fullscreen is swallowing the mouseup event which we use to clear the pressed setting.

I’ve created an engine issue here: https://github.com/playcanvas/engine/issues/592

As a work around you can directly modify the button storage in the Mouse device object.

app.mouse._buttons[pc.MOUSEBUTTON_LEFT] = false;

But that’s a hack…

1 Like