While I’m playing with key input and mouse input, I noticed one unexpected behavior.
https://playcanvas.com/project/373369/overview/simultaneous-press-test
In test.js, I created these simple key and mouse input code with console.log().
// Called every frame, dt is time in seconds since last update
update: function (dt) {
if (app.keyboard.isPressed(pc.KEY_SPACE) === true) {
console.log("SPACE is pressed");
}
if (app.mouse.isPressed(pc.MOUSEBUTTON_LEFT) === true) {
console.log("MOUSELEFT is pressed");
}
}
When I press KEY_SPACE then MOUSEBUTTON_LEFT, the log for the mouse button doesn’t fire. Right after the symptom, even after I release space key, mouse button log doesn’t fire for around 0.5 sec.
When I press MOUSEBUTTON_LEFT then KEY_SPACE, both logs fire reciprocally. I tried with mouse event handler. But it seemed the key down event doesn’t fire either while KEY_SPACE is pressed.
I think this is an unexpected behavior of the engine. What is the cause? FYI, I’m using the latest Chrome on Windows.