Update docs for DC-1 testing, fix toolbar clipping
- Updated DESIGN.md: rendering strategy (no backing bitmap, screen-space grid, viewport clamping), added line snap and box tool documentation - Updated PROGRESS.md: DC-1 testing results and fixes applied - Updated CLAUDE.md: key conventions for rendering - Fix toolbar overlap: use clipToBounds on canvas AndroidView to prevent it from drawing over the toolbar area Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
37
DESIGN.md
37
DESIGN.md
@@ -181,20 +181,39 @@ The editor toolbar controls the active mode:
|
||||
| Draw | Create strokes with the active pen size |
|
||||
| Erase | Touch a stroke to delete it (stroke-level eraser) |
|
||||
| Select | Draw a rectangle to select strokes, then move/copy/delete |
|
||||
| Box | Drag corner-to-corner to draw rectangles |
|
||||
|
||||
### Line Snap
|
||||
|
||||
When drawing in pen mode, holding the stylus still for 1.5 seconds
|
||||
activates line snap mode. The stroke is replaced with a straight line
|
||||
from the original pen-down point to the current position. Moving the
|
||||
pen continues the straight line. The snap timer is canceled if the pen
|
||||
moves more than ~5mm (60pt at 300 DPI) from the origin before the
|
||||
timer fires. This allows drawing straight lines for diagrams without
|
||||
a separate ruler tool.
|
||||
|
||||
## Rendering Strategy
|
||||
|
||||
### On-Screen
|
||||
|
||||
1. **Completed strokes** are rendered to a backing `Bitmap`. This bitmap is
|
||||
redrawn only when strokes change (add, delete, move).
|
||||
2. **In-progress stroke** (pen is down) is drawn directly to the canvas on
|
||||
each `onDraw` call, on top of the backing bitmap.
|
||||
3. **Grid** is drawn as a separate pass — thin gray lines at 60pt intervals.
|
||||
4. The view `Matrix` transforms everything from canonical to screen space.
|
||||
1. **Completed strokes** are drawn directly as `Path` objects on each
|
||||
`onDraw` call. No backing bitmap — direct path rendering avoids the
|
||||
resolution loss that caused blurry strokes on e-ink displays.
|
||||
2. **In-progress stroke** (pen is down) is drawn on top of completed strokes.
|
||||
3. **Grid** is drawn in screen pixel space (not canonical space) with
|
||||
pixel-snapped line positions. This ensures perfectly uniform square
|
||||
spacing regardless of zoom level. Grid uses 1px screen-space lines.
|
||||
4. **Strokes** are drawn in canonical space via the view `Matrix`.
|
||||
Anti-aliasing is disabled on all paint objects for crisp e-ink rendering.
|
||||
|
||||
This approach means `onDraw` is fast for the common case (pen moving):
|
||||
draw the cached bitmap + one active path + grid.
|
||||
### Viewport
|
||||
|
||||
The page always fills the entire visible canvas area:
|
||||
- Minimum zoom is computed dynamically so the page never appears smaller
|
||||
than the viewport in either dimension.
|
||||
- Pan is clamped so page edges stay at or beyond viewport edges.
|
||||
- Background is white to eliminate any visible non-page area.
|
||||
|
||||
### PDF Export
|
||||
|
||||
@@ -220,6 +239,7 @@ Command pattern with a depth limit of 50:
|
||||
| `DeleteStrokeAction` | Delete stroke | Re-insert stroke |
|
||||
| `MoveStrokesAction` | Offset points | Offset back |
|
||||
| `DeleteMultipleAction`| Delete strokes | Re-insert strokes |
|
||||
| `CopyStrokesAction` | Duplicate strokes | Delete copies |
|
||||
|
||||
The `UndoManager` maintains two stacks. Performing a new action clears the
|
||||
redo stack. Each action also persists or deletes from Room as part of
|
||||
@@ -244,7 +264,6 @@ Stroke-level eraser (not pixel-level):
|
||||
2. Hit test: check stroke bounding box first (fast reject), then check
|
||||
point-by-point distance (threshold: ~42 canonical points / ~3.5mm).
|
||||
3. Hit strokes are deleted immediately (with undo support).
|
||||
4. Backing bitmap is rebuilt after deletion.
|
||||
|
||||
## E-ink Considerations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user