-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add lock options to requestPointerLock #99
Conversation
Due to the IPR issue in #49 , I created this duplicate PR to bypass the CI issue. Hi @james-howard, for some reasons I couldn't add you as reviewers at this PR, I add you here to notify that we create this dup PR for #49 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the all the work on this @alvinjiooo, and earlier editors @NavidZ and @jameshollyergoogle, and all the reviewers.
I am approving the PR based on the following points:
I second @scheib in thanking everyone for their patience with #49 (which was about to become ~5 years old 😞), especially @NavidZ, @jameshollyergoogle, @alvinjiooo, @domenic and @marcoscaceres. |
At this point, I am in favor of landing this PR and move the discussion to open issues as we agreed already. Any objections? FYI @marcoscaceres who was the last reviewer of the original PR #49. |
Landing now but please continue the discussion in linked or new issues. |
This PR replaces #49 originally started by @NavidZ.
The goal of this change is to allow application to access unadjusted mouse movement data while in Pointer Lock. This is a highly requested feature from partners in the gaming space. This change adds a PointerLockOptions object as a parameter to the requestPointerLock() method. The PointerLockOptions object currently only has one useful member which is the boolean unadjustedMovement. Also, to properly return error information and make it easier for developers to implement the requestPointerLock method was changed to return a promise.
The existing Pointer Lock API returns the mouse movement that the platforms give Chrome. By default all platforms include some form of mouse acceleration in the movement information they give Chrome. Mouse acceleration is the artificial increase of velocity when the mouse is moving fast. This is useful in normal use of the pointer when a user is trying to move the mouse across the screen. However, it also makes aiming in first person perspective games very difficult. To solve this problem we are adding an option to get that unadjusted movement data when requesting pointer lock.
With Pointer Lock options now available, applications need the ability to change those options while keeping the lock. This proves difficult using the previous API which fired changed or error events on the document to indicate the result of the request. Particularly troublesome was that the error event gave no reason. To solve this problem for developers a Promise workflow is being introduced. Now when requesting a change the developers can get actionable error information on rejected requests.
Example:
Closes #36
The following tasks have been completed:
Implementation commitment:
Preview | Diff