feat(pen): persist brush kind so it survives reload
Some checks failed
CI / Windows build (push) Has been cancelled
Some checks failed
CI / Windows build (push) Has been cancelled
Closes TODO(brush-persist). EditorStroke now serializes its brush as the stable BrushKind name; sidecars written before this field, and any unknown name, load as fountainPen (back-compat). PenStroke<->EditorStroke carry brush both ways, so a ballpoint/highlighter/pencil stroke keeps its opacity/blend after a document is closed and reopened. Note: InkStroke (the note/scratchpad world-coord format) has no brush field, so notes derive brush from the tool — highlighter is preserved, ballpoint/pencil collapse to fountainPen on reload (TODO: extend InkStroke). PDF documents persist brush fully. analyze clean, 379 tests green.
This commit is contained in:
@@ -339,13 +339,11 @@ class _PenEditorScreenState extends State<PenEditorScreen> {
|
||||
kind: es.tool == EditorTool.highlighter
|
||||
? PenStrokeKind.highlighter
|
||||
: PenStrokeKind.pen,
|
||||
// Brush isn't persisted yet (TODO(brush-persist)); derive it
|
||||
// from the tool so a loaded highlighter still renders with the
|
||||
// highlighter brush (flat width), and pens fall back to the
|
||||
// fountainPen default.
|
||||
brush: es.tool == EditorTool.highlighter
|
||||
? BrushKind.highlighter
|
||||
: BrushKind.fountainPen,
|
||||
// Brush is now persisted on the EditorStroke; carry it through
|
||||
// so a reopened ballpoint/pencil/highlighter keeps its
|
||||
// opacity/blend. Old sidecars without the field decode to
|
||||
// fountainPen (see EditorStroke.brush back-compat default).
|
||||
brush: es.brush,
|
||||
))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user