-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Labels
Description
Summary
Add support for stroke-dashoffset (dash phase) across the engine, SVG import, serialization, and editor UI.
Currently StrokeDashArray is a plain Vec<f32> of alternating dash/gap lengths with no offset. SVG's stroke-dashoffset attribute is silently dropped during import.
Motivation
stroke-dashoffsetis a basic SVG stroke property — dropping it causes visual fidelity loss on import.- Dash offset is essential for animated dashed strokes (e.g. "marching ants" selection, loading spinners).
- Design tools (Figma, Illustrator) expose dash offset as an authorable property.
Scope
Core engine (crates/grida-canvas)
- Add a
dash_offset: f32field to the stroke style schema (alongsidestroke_dash_array) - Wire the offset through to the Skia
PathEffect::dashcall (the second argument isphase) - Update
StrokeDashArrayor the stroke style to carry the offset - Serialization:
.grida(JSON + FlatBuffers) roundtrip for the new field
SVG import (crates/grida-canvas/src/svg)
- Parse
stroke-dashoffsetfrom usvg (path.stroke().dashoffset()) duringfrom_usvgconversion - Store it in
SVGStrokeAttributesand propagate to the node schema
SVG export
- Emit
stroke-dashoffsetwhen non-zero
Editor UI (editor/)
- Expose dash offset in the stroke properties panel (next to dash array)
- Allow interactive editing (drag / numeric input)
References
- SVG spec: https://www.w3.org/TR/SVG11/painting.html#StrokeDashoffsetProperty
- Skia:
SkDashPathEffect::Make(intervals, count, phase) - usvg:
Stroke::dashoffset()returnsf32
Reactions are currently unavailable