All files / web/src/components/toys/number-line types.ts

100% Statements 52/52
100% Branches 0/0
100% Functions 0/0
100% Lines 52/52

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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 531x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
export interface NumberLineState {
  /** Number at center of viewport */
  center: number
  /** CSS pixels per 1 unit (larger = more zoomed in) */
  pixelsPerUnit: number
}
 
export interface TickMark {
  /** The numeric value on the number line */
  value: number
  /** The power of 10 this tick belongs to (0 = ones, 1 = tens, etc.) */
  power: number
  /** Continuous visual prominence (0-1). 1 = anchor, 0.5 = medium, 0 = fine/invisible */
  prominence: number
  /** Overall visibility envelope derived from prominence (0-1) */
  opacity: number
}
 
export interface TickThresholds {
  /** Max ticks to be classified as "anchor" (default: 3) */
  anchorMax: number
  /** Max ticks to be classified as "medium" (default: 13) */
  mediumMax: number
}
 
export const DEFAULT_TICK_THRESHOLDS: TickThresholds = {
  anchorMax: 9,
  mediumMax: 23,
}
 
// Re-export collision types from shared module for backward compatibility
export type { CollisionFadeEntry, CollisionFadeMap } from '../shared/collisionDetection'
 
/** Prime classification info for a tick value */
export interface PrimeTickInfo {
  value: number
  smallestPrimeFactor: number
  isPrime: boolean
  classification: 'prime' | 'composite' | 'one' | 'not-applicable'
}
 
/** Pre-computed constant ready for canvas rendering */
export interface RenderConstant {
  symbol: string
  screenX: number
  /** 0-1 opacity from zoom adequacy */
  opacity: number
  /** Whether user has previously tapped this constant */
  discovered: boolean
  /** Constant ID for hit-testing */
  id: string
}