Refactor pointer capture logic and remove third-person pointer lock target clearing

This commit is contained in:
2026-04-27 18:21:18 +02:00
parent a864a79c15
commit eb7b27e05b
3 changed files with 4 additions and 68 deletions

View File

@@ -4899,7 +4899,9 @@ export function App({ store, initialStatusMessage }: AppProps) {
return;
}
const pointerCaptured = firstPersonTelemetry?.pointerLocked === true;
const pointerCaptured =
activeNavigationMode === "firstPerson" &&
firstPersonTelemetry?.pointerLocked === true;
if (pointerCaptured) {
return;
@@ -4914,7 +4916,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
return () => {
window.removeEventListener("keydown", handleWindowKeyDown);
};
}, [editorState.toolMode, firstPersonTelemetry]);
}, [activeNavigationMode, editorState.toolMode, firstPersonTelemetry]);
const applyProjectName = () => {
const normalizedName = projectNameDraft.trim() || DEFAULT_PROJECT_NAME;

View File

@@ -969,22 +969,8 @@ export class RuntimeHost {
this.runtimeMessageHandler?.(message);
},
setPlayerControllerTelemetry: (telemetry) => {
const pointerLockReleasedFromThirdPerson =
this.currentPlayerControllerTelemetry?.pointerLocked === true &&
telemetry !== null &&
telemetry.pointerLocked === false &&
this.activeController === this.thirdPersonController &&
this.activeRuntimeTargetReference !== null &&
this.resolveRuntimePlayerInputBindings().keyboard.clearTarget ===
"Escape";
this.currentPlayerControllerTelemetry = telemetry;
this.currentPlayerAudioHooks = telemetry?.hooks.audio ?? null;
if (pointerLockReleasedFromThirdPerson) {
this.clearActiveRuntimeTarget();
}
this.playerControllerTelemetryHandler?.(telemetry);
}
};