Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added function call to focus on canvas when setting PointerLock #12418

Merged
merged 2 commits into from
Apr 20, 2022
Merged

Added function call to focus on canvas when setting PointerLock #12418

merged 2 commits into from
Apr 20, 2022

Conversation

PolygonalSun
Copy link
Contributor

@PolygonalSun PolygonalSun commented Apr 20, 2022

In this PR, I've added a line to _RequestPointerlock called by enterPointerlock in the Engine that will set focus on the canvas when a pointerlock is set with enterPointerlock. This reason for this fix was because a user had identified an issue where the pointerlock was successfully being set but keyboard input wasn't working. This was due to the fact that requestPointerlock does not set focus when setting the pointerlock element so no keyboard input was being routed to the canvas. This fix simply sets focus once the pointerlock element has been set.

This fix is in reference to this Forum post: https://forum.babylonjs.com/t/input-not-recognised-until-window-resize-triggered-or-change-focus/15653

@azure-pipelines
Copy link

Please make sure to tag your PR with "bug", "new feature" or "breaking change" tags.

@azure-pipelines
Copy link

Please make sure to tag your PR with "bug", "new feature" or "breaking change" tags.

@azure-pipelines
Copy link

Snapshot stored with reference name:
refs/pull/12418/merge

Test environment:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12418/merge/index.html

To test a playground add it to the URL, for example:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12418/merge/index.html#WGZLGJ#4600

To test the snapshot in the playground itself use (for example):

https://playground.babylonjs.com/?snapshot=refs/pull/12418/merge#BCU1XR#0

@deltakosh deltakosh enabled auto-merge (squash) April 20, 2022 20:06
@azure-pipelines
Copy link

Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12418/merge/testResults/webgl2/index.html

If tests were successful afterwards, this report might not be available anymore.

@deltakosh deltakosh merged commit d1f7705 into BabylonJS:master Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants