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

this.game.interact.request() doesn't return control to game, have to click canvas (pointer lock limitation) -- change ESC to ` #1

Closed
deathcap opened this issue Jan 11, 2014 · 2 comments

Comments

@deathcap
Copy link
Member

When modal elements are closed by clicking outside of them (onto the main game canvas area), pointer lock is acquired, as you would expect. Consequentially this is the most usable way to close modal elements.

However, if the modal is closed programmatically (close() from voxel-modal), such as from a keybinding, then pointer lock is not re-acquired. voxel-modal attempts to:

 // resume game interaction
 this.game.interact.request();

but according to https://npmjs.org/package/pointer-lock:

// request pointer lock: warning, may require being called from a mouse event listener
pointer.request()
@deathcap
Copy link
Member Author

From http://www.chromium.org/developers/design-documents/mouse-lock :

Chrome 21 added support for Mouse Lock without the full screen prerequisite:
A request to lock the mouse when the tab is not in full screen will succeed if it is made with a user gesture (e.g. a mouse click)

but:

Also, when an application exits (i.e. not due to the user pressing ESC, etc.) and reenters mouse lock there is no user gesture required and no exit instructions are shown. This provides for an improved user experience when an application frequently shifts in and out of mouse lock, such as a game with first person controls but a cursor used for inventory management.

"not due to the user pressing ESC".. sure enough I'm using escape (vkey 27) to close, but it already is used for exiting pointerlock. Changing to another key(!) allows the application to re-acquire pointer lock. Would prefer to use ESC but backquote or X are other possibilities.

deathcap added a commit to voxel/voxel-inventory-dialog that referenced this issue Jan 11, 2014
@deathcap
Copy link
Member Author

Changed all "close" keys from escape to `, including: voxel-modal (voxel-chest, voxel-workbench, voxel-console), voxel-inventory-dialog

deathcap added a commit to voxel/voxelmetaverse that referenced this issue Jan 11, 2014
voxel/voxel-clientmc@32b4a1e Self-disable on WS error/end. Closes GH-2
voxel/voxel-clientmc@da0ff8c Send chat to server when entered in voxel-console
voxel/voxel-clientmc@6a2145a Log incoming server chat to voxel-console
voxel/voxel-clientmc@7300206 Echo position on server position update, but player still 'snaps back'
voxel/voxel-clientmc@6c3f151 Use MC player height for stance calculation
voxel/voxel-clientmc@7396bcd Send position updates 50 ms in game timer. Ref GH-3
voxel/voxel-clientmc@38a9b1a Revert "Try using tic to send player position updates every 50 ms"
voxel/voxel-clientmc@c9f8223 Try using tic to send player position updates every 50 ms
voxel/voxel-console@43474f2 Update console-widget
voxel/voxel-console@d8939bf Don't use console-widget's hide/show functionality; defer to voxel-modal container element
voxel/voxel-console@09d4605 Update to voxel-modal ~0.1.1
voxel/voxel-console@5f3a803 Update console-widget
voxel/voxel-console@b96bbb8 Add logNode for formatted text output, remove default 'input' handler
voxel/voxel-inventory-dialog@8ee891f Change close keys to ` and E, remove <escape>. See voxel/voxel-modal#1

Commit message generated by https://github.com/deathcap/lmno-cl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant