[auto] require head visible at all times, reset to framing/paused if lost

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
main
name 2026-04-11 13:24:37 -07:00
parent e0780c4100
commit 754b23010c
1 changed files with 20 additions and 0 deletions

View File

@ -194,6 +194,26 @@ export function detectGesture(
return null
}
// Require head visible at all times (except framing, which has its own check)
if (state.calibrationStatus !== 'framing') {
const nose = landmarks2D[0]
const noseVis = nose && (nose.visibility === undefined || nose.visibility >= 0.5)
if (!noseVis) {
if (state.calibrationStatus === 'calibrating') {
state.calibrationStatus = 'framing'
state.feetVisibleSince = null
state.baselineSamplesL = []
state.baselineSamplesR = []
log(`[gesture] lost head, reset to framing`)
} else if (state.calibrationStatus === 'ready') {
state.calibrationStatus = 'paused'
state.activeStep = null
log(`[gesture] lost head during play, paused`)
}
return null
}
}
const emit = (signal: GestureSignal): GestureSignal => {
state.activeSignal = signal
state.signalShowUntil = now + SIGNAL_DISPLAY_MS