auto-git:

[change] src/app/App.tsx
 [change] src/runtime-three/runtime-host.ts
This commit is contained in:
2026-04-27 15:41:57 +02:00
parent b617056593
commit 5548eaa17f
2 changed files with 76 additions and 32 deletions

View File

@@ -1045,7 +1045,6 @@ export class RuntimeHost {
mount(container: HTMLElement) {
this.container = container;
container.appendChild(this.domElement);
this.domElement.addEventListener("click", this.handleRuntimeClick);
this.domElement.addEventListener(
"pointerdown",
this.handleRuntimePointerDown
@@ -1372,7 +1371,6 @@ export class RuntimeHost {
this.worldBackgroundRenderer.dispose();
this.renderer?.forceContextLoss();
this.renderer?.dispose();
this.domElement.removeEventListener("click", this.handleRuntimeClick);
this.domElement.removeEventListener(
"pointerdown",
this.handleRuntimePointerDown
@@ -5008,6 +5006,7 @@ export class RuntimeHost {
const now = performance.now();
const dt = Math.min((now - this.previousFrameTime) / 1000, 1 / 20);
this.previousFrameTime = now;
this.updateInteractInputState();
this.updatePauseInputState();
this.updateRuntimeTargetingInputState();
const simulationDt = this.isRuntimePaused() ? 0 : dt;
@@ -6591,7 +6590,7 @@ export class RuntimeHost {
}
}
private handleRuntimeClick = () => {
private dispatchRuntimeInteract() {
if (
!this.sceneReady ||
this.runtimeScene === null ||
@@ -6621,7 +6620,7 @@ export class RuntimeHost {
this.runtimeScene,
this.createInteractionDispatcher()
);
};
}
private handleRuntimePointerDown = (event: PointerEvent) => {
if (!this.sceneReady) {
@@ -6630,6 +6629,20 @@ export class RuntimeHost {
this.audioSystem.handleUserGesture();
if (this.runtimeScene !== null) {
const pointerBinding = getPlayerStartMouseBindingCodeForButton(
event.button
);
if (
pointerBinding !== null &&
this.runtimeScene.playerInputBindings.keyboard.interact ===
pointerBinding
) {
this.dispatchRuntimeInteract();
}
}
if (
this.activeRuntimeCameraRig === null ||
!this.activeRuntimeCameraRig.lookAround.enabled ||
@@ -6664,6 +6677,18 @@ export class RuntimeHost {
return;
}
const interactKeyboardBinding =
this.runtimeScene.playerInputBindings.keyboard.interact;
if (
!isPlayerStartMouseBindingCode(interactKeyboardBinding) &&
event.code === interactKeyboardBinding
) {
event.preventDefault();
this.dispatchRuntimeInteract();
this.previousInteractInputActive = true;
return;
}
if (event.code === "Tab") {
event.preventDefault();
this.activateOrCycleRuntimeTarget();
@@ -6748,6 +6773,25 @@ export class RuntimeHost {
this.cameraRigLookDragging = false;
};
private updateInteractInputState() {
if (this.runtimeScene === null || !this.sceneReady) {
this.previousInteractInputActive = false;
return;
}
const interactInputActive =
resolvePlayerStartInteractInput(
this.pressedKeys,
this.runtimeScene.playerInputBindings
) >= 0.5;
if (interactInputActive && !this.previousInteractInputActive) {
this.dispatchRuntimeInteract();
}
this.previousInteractInputActive = interactInputActive;
}
private updatePauseInputState() {
if (this.runtimeScene === null || !this.sceneReady) {
this.previousPauseInputActive = false;