This commit is contained in:
Martino Ferrari
2026-04-25 23:10:51 +02:00
parent 986f6cd6d8
commit 91b42027c9
6 changed files with 525 additions and 136 deletions
+23 -15
View File
@@ -214,24 +214,32 @@
---
## Phase 7 — Edit Mode (Advanced)
## Phase 7 — Edit Mode (Advanced)
**Goal:** complete editing UX matching the functional spec.
- [ ] Multi-select: Ctrl+click toggle; rubber-band area select
- [ ] Group move: drag any selected widget to move all
- [ ] Group delete: Del key on selection
- [ ] Align toolbar: left / center-H / right / top / center-V / bottom
- [ ] Distribute toolbar: evenly by center / by gap (H and V)
- [ ] Undo / redo: command pattern, Ctrl+Z / Ctrl+Shift+Z
- [ ] Snap-to-grid (optional, toggle in toolbar)
- [ ] Add text label tool
- [ ] Add image tool (upload to server or embed base64)
- [ ] Add link tool
- [ ] Collapsible signal tree pane and properties pane (toggle buttons)
- [ ] Right-click on interface in list: Edit / Clone / Delete
- [x] Multi-select: Ctrl+click toggle; rubber-band area select
- [x] Group move: drag any selected widget moves all selected widgets
- [x] Group delete: Del/Backspace key deletes all selected widgets
- [x] Align toolbar (≥2 selected): left / center-H / right / top / center-V / bottom
- [x] Distribute toolbar (≥3 selected): H and V gap-equalize
- [x] Undo / redo: 50-step snapshot stack, Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z; ↩↪ toolbar buttons
- [x] Snap-to-grid toggle in toolbar (10px grid, toggle off for free positioning)
- [x] Arrow-key nudge (1px or grid-step with Shift)
- [x] Ctrl+A select-all
- [x] Add text label / image / link via "+ Insert" toolbar dropdown (no signal required)
- [x] Collapsible signal tree and properties pane (collapse toggles already present from Phase 6)
- [x] Interface list actions: click-to-view, edit/clone/delete per item (from Phase 6)
**Done when:** the editor feels complete and the undo stack works reliably.
**Done when:** the editor feels complete and the undo stack works reliably.
**Notes:**
- `EditCanvas` now uses `useRef`-backed stable event handlers (`useEffect(fn, [])`); no stale-closure issue during drag/resize
- Multi-select state: `selectedIds: string[]` in `EditMode`; overlay gets `.selected` class for each ID in the array
- Rubber-band: tracks canvas-relative coords in a `useRef`, calls `setRubberVis` on every mouse-move for the visual, resolves to `onSelect(hitIds)` on mouse-up
- Group drag: `DragState.startPositions` stores start x/y for every selected widget; all move by the same (dx, dy)
- Undo stack is a `useRef<Widget[][]>` (max 50 entries); `historyLen` state variable drives canUndo display
- `pushUndo()` must be called before each mutation (via `handleWidgetsChange` / `handleWidgetChange`)
---
@@ -297,7 +305,7 @@ These are rough single-developer estimates. Parallel work across backend and fro
| 4 | 35 days | ✅ Complete |
| 5 | 23 weeks | ✅ Complete |
| 6 | 23 weeks | ✅ Complete |
| 7 | 12 weeks | |
| 7 | 12 weeks | ✅ Complete |
| 8 | 1 week | — |
| 9 | 1 week | — |
| 10 | 12 weeks | — |