Skip to content

feat: support stroke-dashoffset (dash phase) #588

@softmarshmallow

Description

@softmarshmallow

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-dashoffset is 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: f32 field to the stroke style schema (alongside stroke_dash_array)
  • Wire the offset through to the Skia PathEffect::dash call (the second argument is phase)
  • Update StrokeDashArray or 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-dashoffset from usvg (path.stroke().dashoffset()) during from_usvg conversion
  • Store it in SVGStrokeAttributes and propagate to the node schema

SVG export

  • Emit stroke-dashoffset when non-zero

Editor UI (editor/)

  • Expose dash offset in the stroke properties panel (next to dash array)
  • Allow interactive editing (drag / numeric input)

References

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions