We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 97e3827 commit 750e9f1Copy full SHA for 750e9f1
src/core/systems/ClientControls.js
@@ -68,6 +68,9 @@ export class ClientControls extends System {
68
delta: 0,
69
}
70
this.xrSession = null
71
+
72
+ this.pointerLockOccurred = false
73
+ document.addEventListener('pointerlockchange', () => this.pointerLockOccurred = true, { once: true })
74
75
76
start() {
@@ -406,6 +409,15 @@ export class ClientControls extends System {
406
409
407
410
408
411
412
+ onInitialPointerLock(callback) {
413
+ if (this.pointerLockOccurred) {
414
+ callback.call()
415
416
+ } else {
417
+ document.addEventListener('pointerlockchange', callback, { once: true })
418
+ }
419
420
421
onKeyDown = e => {
422
if (e.defaultPrevented) return
423
if (e.repeat) return
0 commit comments