feat: wire the dev Motion button (label reflects state); chip toggle routes through the same setter

This commit is contained in:
2026-08-20 10:41:31 +10:00
parent 289b5d3afc
commit bf36a21c74
+17 -3
View File
@@ -43,8 +43,16 @@ let camMode = 'none';
/* Diagnostic: freeze all ghost motion (bob/sway/wander/path) so ghosts sit at their /* Diagnostic: freeze all ghost motion (bob/sway/wander/path) so ghosts sit at their
* static spawn position — tells tracking jitter apart from the float animation. * static spawn position — tells tracking jitter apart from the float animation.
* Defaults ON in dev; tap the tracking HUD chip to toggle. */ * Defaults ON in dev; toggle with the "Motion" button (or the tracking chip). */
let freezeGhosts = false; let freezeGhosts = false;
function setFreeze(v) {
freezeGhosts = v;
const b = $('#motionBtn');
if (b) {
b.textContent = `Motion: ${v ? 'frozen' : 'on'}`;
b.classList.toggle('frozen', v);
}
}
let info = { mode: 'dev' }; let info = { mode: 'dev' };
let scene3, camera3, renderer, video, canvas2d, ctx2d; let scene3, camera3, renderer, video, canvas2d, ctx2d;
@@ -233,7 +241,13 @@ async function start() {
// dev-mode pose readout + tap-to-cycle modes // dev-mode pose readout + tap-to-cycle modes
if (info.mode === 'dev') { if (info.mode === 'dev') {
freezeGhosts = true; // start static so tracking jitter is isolated from ghost float // start static so tracking jitter can't be mistaken for the ghost's own float
const mb = $('#motionBtn');
if (mb) {
mb.classList.remove('hidden');
mb.addEventListener('click', () => setFreeze(!freezeGhosts));
}
setFreeze(true);
dbgEl = $('#dbg'); dbgEl = $('#dbg');
if (dbgEl) { if (dbgEl) {
dbgEl.style.display = 'block'; dbgEl.style.display = 'block';
@@ -267,7 +281,7 @@ async function start() {
const trk = $('#trk'); const trk = $('#trk');
if (trk) { if (trk) {
trk.style.pointerEvents = 'auto'; trk.style.pointerEvents = 'auto';
trk.addEventListener('click', () => { freezeGhosts = !freezeGhosts; }); trk.addEventListener('click', () => setFreeze(!freezeGhosts));
} }
} }