Create a subway map designer with station nodes, curved lines, transfer points, and line…
- User
Create a subway map designer with station nodes, curved lines, transfer points, and line coloring. Starts with a sample metro system.
Assistant
I'll build a subway map designer with interactive station editing, curved Bezier lines, transfer point rendering, and line coloring. Let me start by exploring the project structure.
Now I have a clear picture. Let me build the subway map designer. I'll create type definitions, sample data, utilities, and components.
Now let me create the SVG canvas component with all the interactive features:
Let me fix the pan state type:
Now let me create the sidebar component for managing lines and the main App:
Now let me create the main App component that ties everything together:
Let me update the HTML title and build the project:
The build succeeded. Let me verify the output and run a final build check:
The Metro Map Designer is complete and builds successfully. Here's what I built:
Features
🗺️ Interactive SVG Canvas
- Sample metro system with 4 lines, 23 stations, and 5 transfer points
- Smooth cubic Bezier curves between stations
- Automatic parallel-line offset where lines share segments
- Pan (middle-click drag), zoom (scroll wheel or buttons), reset view
🚉 Station Rendering
- Regular stations: white circles with colored borders matching their line
- Transfer stations: white circles with small colored pills arranged around them showing every line that passes through
🎨 Line Management (Left Sidebar)
- 4 pre-loaded colored lines (Red, Blue, Green, Orange)
- Color picker for each line
- Drag-and-drop station reordering within a line
- Add/delete lines
🛠️ Four Tools (Top Toolbar)
- Move: Click stations to select, drag to reposition
- Add to Line: Click existing stations to append, click empty canvas to create new station
- Remove from Line: Click stations to remove from selected line
- Delete: Permanently remove stations
📋 Station Panel (Right)
- Shows selected station name, coordinates, and which lines serve it
- Inline rename on click
💾 Import/Export
- Export as standalone SVG or JSON
- Import from JSON file
- Reset to sample map
The sample system features a realistic layout: a horizontal red mainline, a vertical blue line, and two diagonal lines (green NW→SE, orange SW→NE), with transfers at Central, University, Harbor, Market Square, and Tech Park.
Files built:
src/types.ts,src/data/sampleMap.ts,src/utils/geo.ts,src/components/MapCanvas.tsx,src/components/LineSidebar.tsx,src/components/Toolbar.tsx,src/App.tsx,index.html
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.