import { useViewport } from '@xyflow/react' import type { Guide } from '@/utils/alignment' interface AlignmentGuidesProps { guides: Guide[] color?: string } /** * SVG overlay that draws alignment guide lines on top of the React Flow canvas. * Coordinates are in canvas (flow) space; we read the viewport transform to * project them into screen space so lines stay locked to nodes when the user * pans or zooms. */ export function AlignmentGuides({ guides, color = '#00d4ff' }: AlignmentGuidesProps) { const { x: vx, y: vy, zoom } = useViewport() if (guides.length === 0) return null return ( {guides.map((g, i) => { if (g.axis === 'x') { const x = g.position * zoom + vx const y1 = g.start * zoom + vy const y2 = g.end * zoom + vy return ( ) } const y = g.position * zoom + vy const x1 = g.start * zoom + vx const x2 = g.end * zoom + vx return ( ) })} ) }