All files / web/src/arcade-games/know-your-world/features/magnifier index.ts

0% Statements 0/160
0% Branches 0/1
0% Functions 0/1
0% Lines 0/160

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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161                                                                                                                                                                                                                                                                                                                                 
/**
 * Magnifier Feature Module
 *
 * This module handles magnifier-related functionality for the Know Your World game:
 * - Magnifier crosshair visualization
 * - Pixel grid for precision mode feedback
 * - Dimension calculations
 * - Zoom state management
 * - Touch interactions (pan, pinch-to-zoom)
 *
 * ## State Management
 *
 * Magnifier display state (visibility, opacity, expansion) is now managed by the
 * interaction state machine in `features/interaction/useInteractionStateMachine.ts`.
 * Child components can access this state via `MagnifierContext.interaction`.
 *
 * ## Usage
 *
 * ```tsx
 * import {
 *   useMagnifierTouchHandlers,
 *   useMagnifierZoom,
 *   MagnifierCrosshair,
 *   MagnifierPixelGrid,
 *   MagnifierProvider,
 * } from '../features/magnifier'
 *
 * function MapRenderer() {
 *   const interaction = useInteractionStateMachine()
 *   const zoom = useMagnifierZoom({ ... })
 *
 *   // Magnifier visibility and state from state machine
 *   const showMagnifier = interaction.showMagnifier
 *   const magnifierOpacity = interaction.magnifierOpacity
 *
 *   return (
 *     <MagnifierProvider value={magnifierContextValue}>
 *       <MagnifierOverlayWithHandlers ... />
 *     </MagnifierProvider>
 *   )
 * }
 * ```
 */

// ============================================================================
// State Management Hooks
// ============================================================================

export type {
  EmpiricalScaleResult,
  UseEmpiricalScaleReturn,
} from './useEmpiricalScale'
export { useEmpiricalScale } from './useEmpiricalScale'
// Note: useMagnifierState has been removed - magnifier state is now managed by
// the interaction state machine in features/interaction/useInteractionStateMachine.ts
export type {
  MagnifierStyleInputs,
  MagnifierStyleResult,
} from './useMagnifierStyle'
export { useMagnifierStyle } from './useMagnifierStyle'
export type {
  UseMagnifierTouchHandlersOptions,
  UseMagnifierTouchHandlersReturn,
} from './useMagnifierTouchHandlers'
export { useMagnifierTouchHandlers } from './useMagnifierTouchHandlers'

// ============================================================================
// Components
// ============================================================================

export type { MagnifierControlsProps } from './MagnifierControls'
export { MagnifierControls } from './MagnifierControls'
export type { MagnifierCrosshairProps } from './MagnifierCrosshair'
export { MagnifierCrosshair } from './MagnifierCrosshair'
export type { MagnifierOverlayProps } from './MagnifierOverlay'
export { MagnifierOverlay } from './MagnifierOverlay'
export type { MagnifierOverlayWithHandlersProps } from './MagnifierOverlayWithHandlers'
export { MagnifierOverlayWithHandlers } from './MagnifierOverlayWithHandlers'
export type { MagnifierPixelGridProps } from './MagnifierPixelGrid'
export { MagnifierPixelGrid } from './MagnifierPixelGrid'
export type {
  FlashProgress,
  MagnifierRegionsProps,
  MapRegion,
  RegionState,
} from './MagnifierRegions'
export { MagnifierRegions } from './MagnifierRegions'
export type { ZoomLinesOverlayProps } from './ZoomLinesOverlay'
export { ZoomLinesOverlay } from './ZoomLinesOverlay'

// ============================================================================
// Context
// ============================================================================

export type {
  MagnifierContextValue,
  MagnifierProviderProps,
  MagnifierSpring,
  ParsedViewBox,
  PrecisionCalculations,
  SafeZoneMargins,
} from './MagnifierContext'
export {
  MagnifierProvider,
  useMagnifierContext,
  useMagnifierContextSafe,
} from './MagnifierContext'

// ============================================================================
// Types
// ============================================================================

export type {
  CrosshairStyle,
  DebugBoundingBox,
  HeatColors,
  // MagnifierRegionsProps is exported from MagnifierRegions.tsx with improved structure
  ViewportInfo,
} from './types'

// ============================================================================
// Panning Math Utilities
// ============================================================================

export type {
  MagnifierInfo,
  RenderedViewport,
  TouchMultiplierResult,
  ViewportInfo as PanningViewportInfo,
} from './panningMath'
export {
  applyPanDelta,
  calculateMagnifierScale,
  calculateTouchMultiplier,
  calculateViewportScale,
  clampToSvgBounds,
  cursorToSvgCoordinates,
  parseViewBoxDimensions,
} from './panningMath'

// ============================================================================
// Re-exports from Original Locations
// ============================================================================

export type {
  UseMagnifierZoomOptions,
  UseMagnifierZoomReturn,
} from '../../hooks/useMagnifierZoom'

// Zoom hook (will eventually move into this module)
export { useMagnifierZoom } from '../../hooks/useMagnifierZoom'
// Utilities (backward compatibility)
export {
  EXPANDED_MAGNIFIER_MARGIN,
  getAdjustedMagnifiedDimensions,
  getExpandedMagnifierDimensions,
  getMagnifierDimensions,
  MAGNIFIER_SIZE_LARGE,
  MAGNIFIER_SIZE_SMALL,
} from '../../utils/magnifierDimensions'