chore(debug): keep hand tracking source controller display in sync
Store the lil-gui Source controller so setHandTrackingSource() from the settings menu can refresh its display, and log the transition for traceability. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+25
-10
@@ -1,9 +1,11 @@
|
|||||||
import GUI from "lil-gui";
|
import GUI from "lil-gui";
|
||||||
|
import type { Controller } from "lil-gui";
|
||||||
import type { CameraMode, SceneMode } from "@/types/debug/debug";
|
import type { CameraMode, SceneMode } from "@/types/debug/debug";
|
||||||
import type { HandTrackingSource } from "@/types/handTracking/handTracking";
|
import type { HandTrackingSource } from "@/types/handTracking/handTracking";
|
||||||
import { FOG_CONFIG } from "@/data/world/fogConfig";
|
import { FOG_CONFIG } from "@/data/world/fogConfig";
|
||||||
import { EventEmitter } from "@/utils/core/EventEmitter";
|
import { EventEmitter } from "@/utils/core/EventEmitter";
|
||||||
import { isDebugEnabled } from "@/utils/debug/isDebugEnabled";
|
import { isDebugEnabled } from "@/utils/debug/isDebugEnabled";
|
||||||
|
import { logger } from "@/utils/core/Logger";
|
||||||
|
|
||||||
const DEBUG_CONTROLS_STORAGE_KEY = "la-fabrik-debug-controls";
|
const DEBUG_CONTROLS_STORAGE_KEY = "la-fabrik-debug-controls";
|
||||||
|
|
||||||
@@ -77,6 +79,7 @@ export class Debug {
|
|||||||
private readonly events = new EventEmitter<DebugEvents>();
|
private readonly events = new EventEmitter<DebugEvents>();
|
||||||
private readonly folders = new Map<string, GUI>();
|
private readonly folders = new Map<string, GUI>();
|
||||||
private readonly folderRefCounts = new Map<string, number>();
|
private readonly folderRefCounts = new Map<string, number>();
|
||||||
|
private handTrackingSourceController: Controller | null = null;
|
||||||
private readonly controls: {
|
private readonly controls: {
|
||||||
cameraMode: CameraMode;
|
cameraMode: CameraMode;
|
||||||
fogEnabled: boolean;
|
fogEnabled: boolean;
|
||||||
@@ -160,16 +163,22 @@ export class Debug {
|
|||||||
this.emit();
|
this.emit();
|
||||||
});
|
});
|
||||||
|
|
||||||
handTrackingFolder
|
this.handTrackingSourceController =
|
||||||
?.add(this.controls, "handTrackingSource", {
|
handTrackingFolder
|
||||||
"Browser JS": "browser",
|
?.add(this.controls, "handTrackingSource", {
|
||||||
Backend: "backend",
|
"Browser JS": "browser",
|
||||||
})
|
Backend: "backend",
|
||||||
.name("Source")
|
})
|
||||||
.onChange((value: HandTrackingSource) => {
|
.name("Source")
|
||||||
this.controls.handTrackingSource = value;
|
.onChange((value: HandTrackingSource) => {
|
||||||
this.saveAndEmit();
|
const previousSource = this.controls.handTrackingSource;
|
||||||
});
|
this.controls.handTrackingSource = value;
|
||||||
|
logger.info("HandTracking", "Debug source changed", {
|
||||||
|
from: previousSource,
|
||||||
|
to: value,
|
||||||
|
});
|
||||||
|
this.saveAndEmit();
|
||||||
|
}) ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +263,13 @@ export class Debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setHandTrackingSource(value: HandTrackingSource): void {
|
setHandTrackingSource(value: HandTrackingSource): void {
|
||||||
|
const previousSource = this.controls.handTrackingSource;
|
||||||
this.controls.handTrackingSource = value;
|
this.controls.handTrackingSource = value;
|
||||||
|
this.handTrackingSourceController?.updateDisplay();
|
||||||
|
logger.info("HandTracking", "Settings source changed", {
|
||||||
|
from: previousSource,
|
||||||
|
to: value,
|
||||||
|
});
|
||||||
this.saveAndEmit();
|
this.saveAndEmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user