Implement Phase 6: undo/redo with command pattern

- UndoableAction interface with AddStrokeAction and DeleteStrokeAction
- UndoManager: undo/redo stacks (depth 50), canUndo/canRedo StateFlows
- EditorViewModel: stroke operations routed through UndoManager,
  visual callbacks sync canvas view without full DB reload
- Toolbar: undo/redo buttons with enabled state
- 9 unit tests for UndoManager

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 14:40:24 -07:00
parent 7cf779934d
commit 5eeedff464
9 changed files with 326 additions and 13 deletions

View File

@@ -71,9 +71,18 @@ See PROJECT_PLAN.md for the full step list.
processes historical touch points for thorough erasing, deletes from
view + Room DB, rebuilds backing bitmap
### Phase 6: Undo/Redo (2026-03-24)
- [x] 6.1: UndoableAction interface, AddStrokeAction, DeleteStrokeAction
- [x] 6.2: UndoManager with undo/redo stacks (depth 50), StateFlow for canUndo/canRedo
- [x] 6.3: EditorViewModel rewired — stroke add/delete go through UndoManager,
visual callbacks sync canvas view without full reload
- [x] 6.4: 9 unit tests for UndoManager (perform, undo, redo, depth limit, clear, no-ops)
- Toolbar now has undo/redo buttons with enabled state
## In Progress
Phase 6: Undo/Redo
Phase 7: Selection
## Decisions & Deviations