diff --git a/openspec/changes/archive/2026-02-17-line-rectangle-annotations/.openspec.yaml b/openspec/changes/archive/2026-02-17-line-rectangle-annotations/.openspec.yaml new file mode 100644 index 0000000..2a45c1f --- /dev/null +++ b/openspec/changes/archive/2026-02-17-line-rectangle-annotations/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-02-15 diff --git a/openspec/changes/archive/2026-02-17-line-rectangle-annotations/design.md b/openspec/changes/archive/2026-02-17-line-rectangle-annotations/design.md new file mode 100644 index 0000000..4cd4138 --- /dev/null +++ b/openspec/changes/archive/2026-02-17-line-rectangle-annotations/design.md @@ -0,0 +1,92 @@ +## Context + +The candle annotator uses lightweight-charts for rendering candlestick data and currently has two rendering layers for annotations: + +1. **Canvas-based (ISeriesPrimitive)**: Used by `SpanRectanglePrimitive.ts` for span annotations. These are attached to the series via `series.attachPrimitive()` and render natively within the chart canvas. They support `hitTest()`, autoscaling, and z-ordering. + +2. **SVG overlay**: Used by `SvgOverlay.tsx` for line annotations. An absolutely-positioned SVG element sits on top of the chart with `zIndex: 1111`, intercepting pointer events when the line or delete tool is active. It duplicates coordinate conversion logic and manages its own interaction state. + +The existing `src/plugins/trend-line.ts` already implements a `TrendLine` class using `ISeriesPrimitive