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

@@ -41,9 +41,24 @@ See PROJECT_PLAN.md for the full step list.
- [x] 2.5: Navigation wired — tap notebook → pages stub, editor stub
- EngPadTheme: high-contrast light color scheme (black on white for e-ink)
### Phase 3: Canvas — Basic Drawing (2026-03-24)
- [x] 3.13.4: PadCanvasView — stylus input with historical points, Path/Paint
stroke rendering, backing bitmap at 1/4 resolution, 60pt grid, Matrix
coordinate transform (canonical ↔ screen)
- [x] 3.5: CanvasState — tool enum (PEN_FINE, PEN_MEDIUM, ERASER, SELECT),
zoom/pan state, pen width constants (4.49pt, 5.91pt)
- [x] 3.6: EditorViewModel — loads strokes from Room, saves on completion
- [x] 3.7: EditorScreen + Toolbar — Compose wrapper with AndroidView,
FilterChip toolbar for pen size and eraser selection
- [x] 3.8: NavGraph updated — pages route auto-navigates to first page's editor,
page size passed through route params
- Used KTX Canvas extensions (withMatrix, withScale, createBitmap) per lint
- ClickableViewAccessibility suppressed on PadCanvasView (drawing view)
## In Progress
Phase 3: Canvas — Basic Drawing
Phase 4: Zoom and Pan
## Decisions & Deviations