feat: implement SpanRectanglePrimitive for span annotation rendering

- Created SpanRectanglePrimitive.ts implementing ISeriesPrimitive interface
- Implemented updateAllViews() with coordinate conversion from data-space to pixel-space
- Added semi-transparent rectangle rendering with configurable opacity
- Implemented label tag rendering above rectangles showing pattern names
- Added hitTest() for click detection within span bounds
- Implemented highlight state with thicker borders and increased opacity
- Set zOrder to 'bottom' to render rectangles behind candlesticks
- Completed Section 4 tasks (4.1-4.6) from span-annotation specification

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-14 06:35:01 +01:00
parent 7c1007f712
commit 5ea63a613e
2 changed files with 246 additions and 6 deletions

View file

@ -21,12 +21,12 @@
## 4. SpanRectanglePrimitive (Chart Rendering)
- [ ] 4.1 Create `SpanRectanglePrimitive.ts` implementing `ISeriesPrimitive` with data-space rectangle coordinates (start_time, end_time, max_high, min_low)
- [ ] 4.2 Implement `updateAllViews()` with a pane renderer that converts time/price to pixel coordinates and draws a filled semi-transparent rectangle using `useBitmapCoordinateSpace`
- [ ] 4.3 Implement label tag text rendering above the rectangle (pattern name)
- [ ] 4.4 Implement `hitTest()` to detect clicks within the rectangle bounds
- [ ] 4.5 Add highlight state (thicker border / increased opacity) for selected spans
- [ ] 4.6 Set `zOrder: 'bottom'` so rectangles render behind candlesticks
- [x] 4.1 Create `SpanRectanglePrimitive.ts` implementing `ISeriesPrimitive` with data-space rectangle coordinates (start_time, end_time, max_high, min_low)
- [x] 4.2 Implement `updateAllViews()` with a pane renderer that converts time/price to pixel coordinates and draws a filled semi-transparent rectangle using `useBitmapCoordinateSpace`
- [x] 4.3 Implement label tag text rendering above the rectangle (pattern name)
- [x] 4.4 Implement `hitTest()` to detect clicks within the rectangle bounds
- [x] 4.5 Add highlight state (thicker border / increased opacity) for selected spans
- [x] 4.6 Set `zOrder: 'bottom'` so rectangles render behind candlesticks
## 5. Span Tool State & Integration