Skip to content

Commit 30cf807

Browse files
authored
Use raw mouse input in free flight mode (#763)
* Use raw mouse input in free flight mode * Add fallback in case raw mouse input is not supported
1 parent 160c370 commit 30cf807

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,17 @@ export class FreeFlightControls {
152152

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

0 commit comments

Comments
 (0)