mattercontrol/TODO.md

497 lines
14 KiB
Markdown
Raw Normal View History

2026-01-28 20:12:47 -08:00
# MatterControl Web Port - Development Checklist
A step-by-step checklist for porting MatterControl's design features to a Vue + TypeScript + three.js web application.
---
## Phase 1: Project Foundation
### Development Environment
2026-01-28 21:45:39 -08:00
- [x] Create `flake.nix` with Node.js and pnpm
2026-01-28 21:48:53 -08:00
- [x] Add Rust toolchain to `flake.nix` (for later WASM work)
- [x] Add `flake.lock` and verify `nix develop` works
2026-01-28 22:20:51 -08:00
- [x] Create `Justfile` with `dev`, `build`, `test`, `lint`, `format` recipes
2026-01-28 20:12:47 -08:00
### Vue Project Scaffold
2026-01-28 22:34:23 -08:00
- [x] Initialize Vue 3 project with Vite and TypeScript
2026-01-28 22:41:50 -08:00
- [x] Add ESLint and Prettier configuration
2026-01-28 22:42:53 -08:00
- [x] Create folder structure (`components/`, `composables/`, `stores/`, `types/`)
2026-01-28 22:44:31 -08:00
- [x] Add Pinia for state management
2026-01-28 20:12:47 -08:00
### Testing Infrastructure
2026-01-28 23:22:55 -08:00
- [x] Add Vitest for unit testing
- [x] Create first placeholder test
- [x] Add test script to `Justfile`
2026-01-28 20:12:47 -08:00
---
## Phase 2: 3D Viewport Foundation
### three.js Setup
2026-01-28 23:39:01 -08:00
- [x] Install three.js and `@types/three`
- [x] Create `Viewport.vue` component with canvas element
- [x] Initialize three.js Scene, Camera, and Renderer
- [x] Add resize observer for responsive canvas
- [x] Implement render loop with `requestAnimationFrame`
- [x] Add basic lighting (ambient + two directional)
2026-01-28 20:12:47 -08:00
### Scene Helpers
2026-01-28 23:44:16 -08:00
- [x] Add ground grid helper (XZ plane)
2026-01-28 23:45:55 -08:00
- [x] Add axis helper (RGB arrows for X/Y/Z)
2026-01-28 23:47:13 -08:00
- [x] Add option to toggle grid visibility
2026-01-28 23:48:10 -08:00
- [x] Add option to toggle axis visibility
2026-01-28 20:12:47 -08:00
### Camera Controls
2026-01-28 23:57:44 -08:00
- [x] Install and configure OrbitControls (zoom, pan, orbit)
2026-01-28 23:59:27 -08:00
- [x] Add "fit to selection" camera function
2026-01-29 00:00:58 -08:00
- [x] Add "reset view" function (home position)
2026-01-29 00:01:58 -08:00
- [x] Add view presets (front, back, top, bottom, left, right)
2026-01-29 00:04:05 -08:00
- [x] Add orthographic/perspective toggle
2026-01-28 20:12:47 -08:00
### Scene State Management
2026-01-29 00:20:16 -08:00
- [x] Create `useScene` composable for scene state
- [x] Define `SceneObject` interface (id, name, mesh, visible, locked)
- [x] Implement `addObject()` function
- [x] Implement `removeObject()` function
- [x] Implement `clearScene()` function
2026-01-29 00:24:41 -08:00
- [x] Add scene object list to Pinia store
2026-01-28 20:12:47 -08:00
---
## Phase 3: Core UI Layout
### Application Shell
2026-01-29 00:32:11 -08:00
- [x] Create `AppLayout.vue` with CSS Grid layout
- [x] Add header area with app title
- [x] Add left sidebar container (tools panel)
- [x] Add right sidebar container (properties panel)
- [x] Add center viewport area
- [x] Add bottom status bar
2026-01-28 20:12:47 -08:00
### Theme System
2026-01-29 00:34:34 -08:00
- [x] Define CSS custom properties for colors
- [x] Define CSS custom properties for spacing
- [x] Define CSS custom properties for typography
- [x] Create dark theme color palette
- [x] Apply theme to all components
2026-01-28 20:12:47 -08:00
### Sidebar Behavior
2026-01-29 01:06:48 -08:00
- [x] Create collapsible sidebar component
- [x] Add toggle buttons for left/right sidebars
- [x] Persist sidebar state to localStorage
- [x] Handle responsive layout for narrow screens
2026-01-28 20:12:47 -08:00
---
## Phase 4: Selection System
### Object Picking
2026-01-29 01:23:34 -08:00
- [x] Add Raycaster for mouse picking
2026-01-29 01:26:33 -08:00
- [x] Implement click-to-select single object
- [x] Implement click-on-empty to deselect
- [x] Add `selectedObjects` array to Pinia store
2026-01-29 01:29:25 -08:00
- [x] Implement Shift+click for multi-select
- [x] Implement Ctrl+click to toggle selection
- [x] Add "Select All" (Ctrl+A) shortcut
2026-01-28 20:12:47 -08:00
### Selection Visualization
2026-01-29 01:34:49 -08:00
- [x] Add selection outline effect (OutlinePass or custom)
- [x] Add hover highlight on mouseover
- [x] Distinguish single vs multi-selection visually
2026-01-28 20:12:47 -08:00
### Context Menu
2026-01-29 01:49:48 -08:00
- [x] Create right-click context menu component
- [x] Show context menu on object right-click
- [x] Add "Delete" option to context menu
- [x] Add "Duplicate" option to context menu
- [x] Add "Group" option to context menu
- [x] Close menu on click outside
2026-01-28 20:12:47 -08:00
---
## Phase 5: Transform Tools
2026-01-29 15:59:27 -08:00
### Translate Mode (Default with Selection)
2026-01-29 16:26:27 -08:00
- [x] Create custom translate gizmo with 3 axis arrows (colored by axis)
- [x] Attach gizmo to selected object(s)
- [x] Left-drag handle: free translate along axis
- [x] Right-drag handle: grid-aligned translate along axis
- [x] Mouse wheel on handle: change grid granularity
- [x] Hide gizmo when nothing selected
2026-01-28 20:12:47 -08:00
2026-01-29 15:59:27 -08:00
### Rotation Mode (Ctrl Modifier)
2026-01-29 16:45:50 -08:00
- [x] Create custom rotation gizmo with flat ring handles per axis
- [x] Show rotation rings when Ctrl held with selection
- [x] Hover effect: ring thickens and brightens
- [x] Left-drag ring: free (by-pixel) rotation
- [x] Right-drag ring: constrained rotation (15°, 30°, 45° based on mouse distance from control)
2026-01-29 17:26:34 -08:00
- [x] Display angle wheel during constrained rotation (world-oriented)
- [x] Track object rotation state for world-oriented snapping
2026-01-29 15:59:27 -08:00
### Scale Mode (Ctrl+Shift Modifier)
2026-01-29 22:34:59 -08:00
- [x] Create bounding box visualization for selection
- [x] Show scale handles when Ctrl+Shift held with selection
- [x] Corner handles: white cubes for uniform scaling
- [x] Left-drag: free scale
- [x] Right-drag: symmetrical proportional scale from center
- [x] Face center handles: colored cubes (by axis) for stretch
- [x] Left-drag: one-directional stretch along axis
- [x] Right-drag: symmetrical stretch from center along axis
- [x] Hover effect: handles grow subtly and brighten
2026-01-29 15:59:27 -08:00
### Camera Mode (Alt Modifier)
- [ ] Left-drag: orbit camera
- [ ] Right-drag: pan camera
- [ ] Left-click object: center/zoom camera on object
### Shift Modifier Behaviors
- [ ] Click with Shift: add to selection (already in Phase 4)
- [ ] Drag translate handle with Shift: duplicate selection along axis
2026-01-28 20:12:47 -08:00
---
## Phase 6: Properties Panel
### Panel Structure
- [ ] Create `PropertiesPanel.vue` component
- [ ] Show "No selection" state when empty
- [ ] Show "Multiple objects" state for multi-select
- [ ] Add collapsible sections
### Object Properties
- [ ] Display and edit object name
- [ ] Display and edit position (X, Y, Z)
- [ ] Display and edit rotation (X, Y, Z in degrees)
- [ ] Display and edit scale (X, Y, Z)
- [ ] Add uniform scale toggle (lock aspect ratio)
### Object State
- [ ] Add visibility toggle (eye icon)
- [ ] Add lock toggle (lock icon)
- [ ] Reflect visibility in viewport
- [ ] Prevent selection/transform of locked objects
### Mesh Info
- [ ] Display vertex count
- [ ] Display face count
- [ ] Display bounding box dimensions
---
## Phase 7: Undo/Redo System
### Command Infrastructure
- [ ] Define `Command` interface (execute, undo)
- [ ] Create `useHistory` composable
- [ ] Implement undo stack with max depth (50)
- [ ] Implement redo stack
- [ ] Clear redo stack on new action
### Core Commands
- [ ] Implement `AddObjectCommand`
- [ ] Implement `RemoveObjectCommand`
- [ ] Implement `TransformCommand`
- [ ] Implement `RenameCommand`
- [ ] Implement `GroupCommand`
### Integration
- [ ] Wrap all scene modifications in commands
- [ ] Wire Ctrl+Z to undo
- [ ] Wire Ctrl+Y / Ctrl+Shift+Z to redo
- [ ] Add undo/redo buttons to toolbar
- [ ] Disable buttons when stack empty
---
## Phase 8: File Import/Export
### STL Support
- [ ] Add three.js `STLLoader`
- [ ] Create file input component for import
- [ ] Parse STL and add mesh to scene
- [ ] Add three.js `STLExporter`
- [ ] Implement "Export as STL" function
- [ ] Add binary/ASCII export option
### OBJ Support
- [ ] Add three.js `OBJLoader`
- [ ] Parse OBJ and add mesh to scene
- [ ] Add three.js `OBJExporter`
- [ ] Implement "Export as OBJ" function
### Export Options
- [ ] Create export dialog component
- [ ] Add "Export Selected" option
- [ ] Add "Export All" option
- [ ] Remember last export settings
### Drag and Drop
- [ ] Add drag-and-drop zone overlay
- [ ] Detect file type from extension
- [ ] Route to appropriate loader
- [ ] Show loading indicator during import
- [ ] Handle import errors with toast message
---
## Phase 9: Primitives (MVP)
### Primitive Generation
- [ ] Create `usePrimitives` composable
- [ ] Implement Box primitive
- [ ] Implement Sphere primitive
- [ ] Implement Cylinder primitive
- [ ] Auto-select newly created primitives
- [ ] Place primitives at scene origin (or selection center)
### Primitives Panel
- [ ] Create primitives panel in left sidebar
- [ ] Add clickable primitive icons/buttons
- [ ] Show primitive name on hover
### Parametric Editing
- [ ] Store primitive parameters in object metadata
- [ ] Show parameters in properties panel for primitives
- [ ] Update mesh when parameters change
- [ ] Add "Convert to Mesh" to bake parameters
---
## Phase 10: Clipboard & Grouping
### Clipboard Operations
- [ ] Implement Copy (Ctrl+C) - serialize to clipboard
- [ ] Implement Cut (Ctrl+X) - copy then delete
- [ ] Implement Paste (Ctrl+V) - deserialize and add
- [ ] Offset pasted objects slightly to show difference
- [ ] Implement Duplicate (Ctrl+D) - copy + paste in one action
### Object Grouping
- [ ] Implement Group command (Ctrl+G)
- [ ] Create Group object that contains children
- [ ] Select group selects all children
- [ ] Transform group transforms all children
- [ ] Implement Ungroup command (Ctrl+Shift+G)
- [ ] Allow entering group to edit children
---
2026-01-29 15:59:27 -08:00
## Phase 11: Continuous Autosave
2026-01-28 20:12:47 -08:00
### Database Setup
- [ ] Install `idb` library (IndexedDB wrapper)
- [ ] Define database schema version 1
2026-01-29 15:59:27 -08:00
- [ ] Create `scene` object store for current scene state
2026-01-28 20:12:47 -08:00
- [ ] Create `settings` object store
- [ ] Implement database open/migration
### Scene Serialization
- [ ] Serialize mesh geometry (positions, normals, indices)
- [ ] Serialize object transforms and metadata
- [ ] Serialize group hierarchy
- [ ] Handle large meshes efficiently (binary format)
2026-01-29 15:59:27 -08:00
### Continuous Autosave
- [ ] Implement autosave on every scene change (debounced)
- [ ] Save immediately on significant actions (add/delete object, transform complete)
- [ ] Load saved scene automatically on app start
- [ ] Handle serialization errors gracefully
- [ ] Show subtle save indicator during autosave (optional)
2026-01-28 20:12:47 -08:00
---
## Phase 12: Project Management UI
### Toolbar Actions
- [ ] Add "New" button - create empty project
- [ ] Add "Open" button - show project browser
- [ ] Add "Save" button - save current project
- [ ] Add "Save As" button - save with new name
- [ ] Add "Export" button - open export dialog
### Project Browser
- [ ] Create project browser dialog
- [ ] Display projects as list with name and date
- [ ] Add delete button per project
- [ ] Add rename option per project
- [ ] Double-click to open project
### Recent Projects
- [ ] Track recently opened projects
- [ ] Add recent projects to File menu
- [ ] Limit to last 5-10 projects
---
## Phase 13: Extended Primitives
### Additional Shapes
- [ ] Implement Cone primitive
- [ ] Implement Torus primitive
- [ ] Implement Plane/Quad primitive
- [ ] Implement Wedge/Prism primitive
- [ ] Add parameter UI for each shape
### Text Primitive
- [ ] Add font loading (Google Fonts or bundled)
- [ ] Implement 3D extruded text
- [ ] Add text content input
- [ ] Add font size parameter
- [ ] Add extrusion depth parameter
- [ ] Add font family selector
---
## Phase 14: Basic Mesh Operations
### Transform Operations
- [ ] Implement "Center to Origin"
- [ ] Implement "Align to Ground" (bottom at Z=0)
- [ ] Implement "Mirror X"
- [ ] Implement "Mirror Y"
- [ ] Implement "Mirror Z"
### Array/Pattern
- [ ] Implement linear array (count + spacing)
- [ ] Implement grid array (X count × Y count)
- [ ] Create array objects as group
### Mesh Utilities
- [ ] Implement "Flip Normals"
- [ ] Implement "Recompute Normals" (flat/smooth)
- [ ] Implement "Merge Vertices" (weld by distance)
---
## Phase 15: Boolean Operations (CSG)
### CSG Setup
- [ ] Research and select CSG library (manifold.js recommended)
- [ ] Install and test CSG library
- [ ] Create Web Worker for CSG operations
- [ ] Create `useBooleans` composable
### Boolean Operations
- [ ] Implement Union (combine meshes)
- [ ] Implement Subtract (cut mesh from mesh)
- [ ] Implement Intersect (keep overlap)
- [ ] Validate: require exactly 2 objects selected
- [ ] Handle CSG errors gracefully
### Boolean UI
- [ ] Add Boolean section to toolbar or menu
- [ ] Show progress indicator for slow operations
- [ ] Add operation to undo history
---
## Phase 16: Advanced Mesh Operations
### Mesh Modification
- [ ] Implement mesh simplification (decimate)
- [ ] Add target face count or ratio input
- [ ] Implement subdivision smooth
- [ ] Add subdivision level input
### Mesh Analysis
- [ ] Detect non-manifold edges
- [ ] Highlight non-manifold edges in red
- [ ] Detect holes (boundary edges)
- [ ] Implement "Fill Holes" repair
---
## Phase 17: Library Browser
### Library Panel
- [ ] Create `LibraryPanel.vue` in left sidebar
- [ ] Display saved projects as cards
- [ ] Show project name and modified date
- [ ] Add search/filter input
### Thumbnails
- [ ] Generate thumbnail on project save
- [ ] Render scene to off-screen canvas
- [ ] Store thumbnail as data URL in IndexedDB
- [ ] Display thumbnail in library card
---
## Phase 18: Polish & UX
### User Feedback
- [ ] Add toast notification system
- [ ] Show success toast on save
- [ ] Show error toast on failures
- [ ] Add loading spinner component
- [ ] Show loading during imports
### Confirmations
- [ ] Add confirmation dialog component
- [ ] Confirm before delete objects
- [ ] Confirm before delete project
- [ ] Confirm before clear scene
### Keyboard Shortcuts Help
- [ ] Create keyboard shortcuts modal
- [ ] Add "?" key to open shortcuts help
- [ ] List all available shortcuts
---
## Phase 19: Performance
### Render Optimization
- [ ] Profile render loop performance
- [ ] Implement frustum culling
- [ ] Add level-of-detail for distant objects
- [ ] Throttle property panel updates
### Large Scenes
- [ ] Test with 100+ objects
- [ ] Optimize scene tree rendering
- [ ] Lazy-render off-screen UI
- [ ] Profile memory usage
---
## Phase 20: Rust + WASM Migration
### Rust Project Setup
- [ ] Create `crates/mesh-ops/` directory
- [ ] Initialize Cargo workspace
- [ ] Add wasm-bindgen dependency
- [ ] Add nalgebra dependency
- [ ] Configure wasm-pack build
- [ ] Update `just wasm` recipe
### Mesh Data in Rust
- [ ] Define Mesh struct (vertices, indices, normals)
- [ ] Implement mesh creation from JS arrays
- [ ] Implement mesh export to JS arrays
- [ ] Add tests for mesh operations
### Port Operations to Rust
- [ ] Port "Merge Vertices" to Rust
- [ ] Port "Compute Normals" to Rust
- [ ] Port mesh simplification to Rust
- [ ] Port CSG operations to Rust (or wrap manifold)
### Integration
- [ ] Create TypeScript wrapper for WASM module
- [ ] Replace JS implementations with WASM calls
- [ ] Benchmark performance improvement
- [ ] Add WASM loading fallback for old browsers
---
## Future Considerations (Out of Scope)
- [ ] Additional file formats (3MF, AMF, STEP)
- [ ] Measurement tools (distance, angle)
- [ ] Section view / clipping planes
- [ ] Multi-user collaboration
- [ ] Plugin/extension system
- [ ] Mobile/touch support
- [ ] Offline PWA support