import { useHandTrackingSnapshot } from "@/hooks/handTracking/useHandTrackingSnapshot"; import { useHandTrackingGloveStatus } from "@/hooks/handTracking/useHandTrackingGloveStatus"; import { useDebugStore } from "@/hooks/debug/useDebugStore"; const HAND_CONNECTIONS: Array<[number, number]> = [ [0, 1], [1, 2], [2, 3], [3, 4], [0, 5], [5, 6], [6, 7], [7, 8], [5, 9], [9, 10], [10, 11], [11, 12], [9, 13], [13, 14], [14, 15], [15, 16], [13, 17], [17, 18], [18, 19], [19, 20], [0, 17], ]; export function HandTrackingVisualizer(): React.JSX.Element | null { const { hands, status } = useHandTrackingSnapshot(); const showHandTrackingSvg = useDebugStore((debug) => debug.getShowHandTrackingSvg(), ); const gloves = useHandTrackingGloveStatus((state) => state.gloves); const hasLoadedGlove = Object.values(gloves).some( (gloveStatus) => gloveStatus === "loaded", ); if ( status === "idle" || hands.length === 0 || (hasLoadedGlove && !showHandTrackingSvg) ) { return null; } return ( ); }