All files / components/screens/training footworkMarkers.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24            3x                       152x          
import type { FootworkDrill } from "./components/FootworkDrillsOverlayHtml";
 
type Point = [number, number, number];
 
export type FootworkDrillPattern = Exclude<FootworkDrill, "free_practice"> | "none";
 
const PATTERNS: Readonly<Record<FootworkDrillPattern, readonly (readonly [number, number])[]>> = {
  circular_left: [[2, 0], [0, -2], [-2, 0], [0, 2]],
  circular_right: [[2, 0], [0, 2], [-2, 0], [0, -2]],
  pivot_combo: [[0, 0], [-0.5, 0.5], [0, 0], [0.5, 0.5]],
  triangle_step: [[0, 0], [0, -0.6], [0.45, 0], [0, 0]],
  slide_drill: [[0, 0], [0, -0.3], [0.3, 0], [0, 0.3], [-0.3, 0]],
  shuffle_practice: [[0, 0], [0, -0.24], [0, -0.48], [0, -0.72]],
  none: [],
};
 
/** Returns the same numbered waypoints for the scene, HUD, and drill progress. */
export function getFootworkMarkers(pattern: FootworkDrillPattern, [x, y, z]: Point): readonly { readonly position: Point; readonly label: string }[] {
  return PATTERNS[pattern].map(([dx, dz], index) => ({
    position: [x + dx, y, z + dz],
    label: String(index + 1),
  }));
}