await requestPointerLock

This commit is contained in:
redphx
2025-01-03 20:43:21 +07:00
parent f13ce94cf2
commit e4dbdea9a5
3 changed files with 6 additions and 6 deletions

View File

@@ -3456,12 +3456,12 @@ class EmulatedMkbHandler extends MkbHandler {
this.prevWheelCode = null, this.pressButton(buttonIndex, !1);
}, 20), !0;
}
toggle(force) {
async toggle(force) {
if (!this.initialized) return;
if (typeof force !== "undefined") this.enabled = force;
else this.enabled = !this.enabled;
if (this.enabled) try {
document.body.requestPointerLock({ unadjustedMovement: !0 });
await document.body.requestPointerLock({ unadjustedMovement: !0 });
} catch (e) {
document.body.requestPointerLock(), console.log(e);
}