I'll create a room planner app with 2D drawing and 3D visualization. Let me start by exploring the project structure.
I'll build a full-featured room planner. First, let me install three.js for the 3D view.
Now let me create the core data model, furniture catalog, and geometry utilities.
Now the geometry engine with room/loop detection and hit-testing:
Now the 2D canvas renderer (shared by the editor and PNG export):
Now the undo/redo store and the 3D furniture builders:
Now the 3D view with three.js and orbit controls:
Now the main 2D planner canvas with full interaction handling:
Now the sidebar (tools + furniture library) and properties panel:
Finally, the main App with the toolbar, 2D/3D toggle, shortcuts, and persistence:
The build succeeded. Let me refine a few details — auto-fit on load, opening depths matching wall thickness, and small polish fixes:
Let me polish the global CSS for a proper full-screen app shell:
The build succeeds. Here's what I built:
🏠 RoomCraft Planner
A complete 2D/3D room planner in the spirit of Planner5D.
Architecture
| File | Purpose |
|---|
src/types.ts | Data model (walls, items, design, settings) — all dimensions in cm |
src/lib/catalog.ts | 38-object furniture library across 7 categories |
src/lib/geometry.ts | Vector math, hit-testing, planar-graph face traversal for automatic room detection + area, demo apartment |
src/lib/render2d.ts | Canvas renderer (shared by editor & PNG export) with per-object top-view drawings |
src/lib/store.ts | Undo/redo history store with transaction support for drags |
src/lib/three-furniture.ts | 20+ procedural 3D furniture builders (sofa, bed, shelf with books, stove burners, glass shower…) |
src/components/Planner2D.tsx | Interactive canvas editor |
src/components/View3D.tsx | three.js scene + OrbitControls |
src/components/Sidebar.tsx / PropertiesPanel.tsx | Tools, library, object inspector |
Part 1 — 2D Planner
- Walls: chained wall tool (click-click or drag), snaps to the grid, to existing wall endpoints (magnet), and to 15° angles with a live length/angle readout
- Rooms: drag a rectangle to instantly create four walls, with live W×H and area preview
- Drag & drop: drag any library item onto the plan (or click to drop at view center); doors/windows automatically magnetize into the nearest wall, adopting its angle and thickness
- Edit: drag to move, rotate handle (15° snap, Alt = free), corner handles, wall endpoint dragging, arrow-key nudge, delete/duplicate, numeric inspector, color swatches
- Measurements: length labels on every wall, automatic room detection with area + bounding dimensions, total area in the header, metric/imperial toggle
- Undo/redo: full history (Ctrl+Z / Ctrl+Shift+Z), one entry per drag gesture
- Export PNG: renders a clean, fitted plan sheet with title block, room stats and a scale bar
- Autosaves to localStorage; zoom to cursor, pan, fit-to-plan
Part 2 — 3D View
- One-click 2D ⇄ 3D toggle in the header; the plan converts automatically
- Walls extruded with real thickness/height, and doors/windows cut actual openings (side pieces + lintel + sill computed per wall)
- Floors generated from the detected room polygons
- Orbit / zoom / pan controls with damping, plus Iso / Top / Front camera presets
- Soft shadows, sun + hemisphere lighting, lamps emit real point lights
- Materials panel: cutaway / solid / ghost walls, shadows toggle, floor & wall colors, global wall-height slider; every object keeps its 2D color in 3D
Files built: src/types.ts, src/lib/catalog.ts, src/lib/geometry.ts, src/lib/render2d.ts, src/lib/store.ts, src/lib/three-furniture.ts, src/components/View3D.tsx, src/components/Planner2D.tsx, src/components/Sidebar.tsx, src/components/PropertiesPanel.tsx, src/App.tsx, index.html, src/index.css