All files / web/src/arcade-games/know-your-world/features/shared constants.ts

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

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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 1171x 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 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Shared constants for Know Your World feature modules
 *
 * Centralizes magic numbers and configuration values that
 * are used across multiple features.
 */
 
import type { SafeZoneMargins } from './types'
 
// ============================================================================
// Precision Mode Constants
// ============================================================================
 
/**
 * Screen pixel ratio threshold that triggers precision mode recommendation.
 * When the magnifier shows ≥20 screen pixels per map pixel, precision mode
 * becomes necessary for accurate selection.
 */
export const PRECISION_MODE_THRESHOLD = 20
 
// ============================================================================
// Zoom Constants
// ============================================================================
 
/**
 * Maximum zoom level for the magnifier.
 * Allows zooming in on tiny regions like Gibraltar (0.08px).
 */
export const MAX_ZOOM = 1000
 
/**
 * Zoom level above which the magnifier shows gold styling.
 * Indicates high magnification where precision may be needed.
 */
export const HIGH_ZOOM_THRESHOLD = 100
 
/**
 * Minimum zoom level (1:1 with map)
 */
export const MIN_ZOOM = 1
 
// ============================================================================
// Safe Zone Constants
// ============================================================================
 
/**
 * Safe zone margins - areas reserved for floating UI elements.
 * These define where findable regions should remain visible.
 */
export const SAFE_ZONE_MARGINS: SafeZoneMargins = {
  /** Space for nav (~150px) + floating prompt (~140px with name input + controls row) */
  top: 290,
  /** Controls now in floating prompt, no right margin needed */
  right: 0,
  /** Error banner can overlap map */
  bottom: 0,
  /** Progress at top-left is small, doesn't need full-height margin */
  left: 0,
}
 
/**
 * Navigation bar height offset for button positioning
 */
export const NAV_HEIGHT_OFFSET = 150
 
// ============================================================================
// Animation Constants
// ============================================================================
 
/**
 * Duration in ms for laser effect after all letters confirmed
 */
export const LASER_EFFECT_DURATION = 750
 
/**
 * Duration in ms for name attention animation
 */
export const NAME_ATTENTION_DURATION = 3000
 
/**
 * Auto-exit expanded magnifier when zoom drops below this threshold
 */
export const AUTO_EXIT_ZOOM_THRESHOLD = 1.5
 
// ============================================================================
// Detection Constants
// ============================================================================
 
/**
 * Detection box size in pixels for region hit testing
 */
export const DETECTION_BOX_SIZE = 50
 
/**
 * Threshold distance for dismissing magnifier after drag
 */
export const DRAG_DISMISS_THRESHOLD = 20
 
// ============================================================================
// Debug Flags
// ============================================================================
 
/**
 * Show technical info in magnifier (gated by isVisualDebugEnabled at runtime)
 */
export const SHOW_MAGNIFIER_DEBUG_INFO = true
 
/**
 * Show bounding boxes with importance scores (gated by isVisualDebugEnabled)
 */
export const SHOW_DEBUG_BOUNDING_BOXES = true
 
/**
 * Show safe zone rectangles (gated by isVisualDebugEnabled)
 */
export const SHOW_SAFE_ZONE_DEBUG = true