Implement Phase 3: canvas drawing with stylus input

- PadCanvasView: custom View with stylus event handling (historical points
  for smoothness), Path/Paint stroke rendering, backing bitmap at 1/4
  resolution, 60pt grid drawing, Matrix coordinate transform
- CanvasState: tool modes (fine/medium pen, eraser, select), zoom/pan state
- EditorViewModel: loads/saves strokes to Room on completion
- EditorScreen: Compose wrapper with AndroidView + FilterChip toolbar
- NavGraph: pages route auto-navigates to first page editor, page size
  passed through route params

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 14:21:17 -07:00
parent 644b8a4732
commit 2fc4224f5a
8 changed files with 579 additions and 18 deletions

View File

@@ -48,19 +48,19 @@ completed and log them in PROGRESS.md.
## Phase 3: Canvas — Basic Drawing
- [ ] 3.1: Implement `PadCanvasView` — stylus event handling
- [x] 3.1: Implement `PadCanvasView` — stylus event handling
- `ui/editor/PadCanvasView.kt``onTouchEvent`, `getHistoricalX/Y`
- [ ] 3.2: Stroke rendering — `Path`/`Paint`, backing bitmap
- [ ] 3.3: Grid drawing — 14.4pt spacing, toggleable
- [ ] 3.4: Coordinate transform — canonical ↔ screen via `Matrix`
- [ ] 3.5: Implement `CanvasState`
- `ui/editor/CanvasState.kt` — zoom, pan, active tool
- [ ] 3.6: Implement `EditorViewModel`
- [x] 3.2: Stroke rendering — `Path`/`Paint`, backing bitmap (1/4 resolution)
- [x] 3.3: Grid drawing — 60pt spacing, drawn on screen only
- [x] 3.4: Coordinate transform — canonical ↔ screen via `Matrix`
- [x] 3.5: Implement `CanvasState`
- `ui/editor/CanvasState.kt` — zoom, pan, active tool, pen widths
- [x] 3.6: Implement `EditorViewModel`
- `ui/editor/EditorViewModel.kt` — load/save strokes from Room
- [ ] 3.7: Implement `EditorScreen` + toolbar
- [x] 3.7: Implement `EditorScreen` + toolbar
- `ui/editor/EditorScreen.kt`, `ui/editor/Toolbar.kt`
- [ ] 3.8: Wire navigation from notebook/page list to editor
- **Verify:** `./gradlew build && ./gradlew test` + manual on-device test
- [x] 3.8: Wire navigation notebook list → pages → editor (pages auto-navigates to first page)
- **Verify:** `./gradlew build` — PASSED (build + test + lint). Manual on-device test pending.
## Phase 4: Zoom and Pan