Skip to content

Commit 6473655

Browse files
committed
Add fallback in case raw mouse input is not supported
1 parent a805010 commit 6473655

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common/webapp/src/js/controls/freeflight/FreeFlightControls.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,16 @@ export class FreeFlightControls {
152152

153153
document.body.requestFullscreen()
154154
.finally(() => {
155+
// try with unadjustedMovement first and fall back without it if not supported
155156
this.target.requestPointerLock({
156157
unadjustedMovement: true
158+
})
159+
.catch(err => {
160+
if (err.name === "NotSupportedError") {
161+
return this.target.requestPointerLock();
162+
} else {
163+
throw err;
164+
}
157165
});
158166
});
159167
}

0 commit comments

Comments
 (0)