/** * Shared grid constants for the metro map canvas. * Used by both rendering (MetroCanvas.vue) and server-side positioning (MapDataService.php). * Server must use the same values — keep in sync with MapDataService::GRID. */ export const GRID = 50 // base snap unit (px) export const GRID_STEP_X = 200 // horizontal spacing between nodes on a line export const GRID_STEP_Y = 150 // vertical spacing between metro lines /** * Snap a value to the nearest grid point. */ export const snapToGrid = (val) => Math.round(val / GRID) * GRID