Refactor pointer lock handling and movement calculation in first-person controller
This commit is contained in:
19
src/runtime-three/pointer-lock-utils.ts
Normal file
19
src/runtime-three/pointer-lock-utils.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export function shouldAutoCapturePointerLockOnActivate(): boolean {
|
||||
if (typeof navigator === "undefined") {
|
||||
return true;
|
||||
}
|
||||
|
||||
const userAgent = navigator.userAgent;
|
||||
const vendor = navigator.vendor;
|
||||
const isSafari =
|
||||
vendor.includes("Apple") &&
|
||||
userAgent.includes("Safari/") &&
|
||||
!userAgent.includes("Chrome/") &&
|
||||
!userAgent.includes("Chromium/") &&
|
||||
!userAgent.includes("CriOS/") &&
|
||||
!userAgent.includes("Edg/") &&
|
||||
!userAgent.includes("OPR/") &&
|
||||
!userAgent.includes("Firefox/");
|
||||
|
||||
return !isSafari;
|
||||
}
|
||||
Reference in New Issue
Block a user