feat: complete rectangle annotation tool (tasks 4.1-5.2)

- Add rectangle primitive management in CandleChart
- Handle chart switching with proper primitive cleanup
- Implement rectangle selection via hitTest
- Add rectangle deletion in delete tool
- Add rectangle tool button to Toolbox
- Wire rectangle tool with toggle behavior
This commit is contained in:
Marko Djordjevic 2026-02-16 11:58:49 +01:00
parent 82fd5ce819
commit aea1791122
3 changed files with 117 additions and 9 deletions

View file

@ -25,15 +25,15 @@
## 4. Wire Up Rectangle Primitives in CandleChart
- [ ] 4.1 On annotation fetch, create `RectangleDrawingPrimitive` instances for `label_type: "rectangle"` annotations and attach to series
- [ ] 4.2 On chart switch, detach old rectangle primitives and create new ones for the new chart's annotations
- [ ] 4.3 Handle rectangle selection — on click hit detected via primitive `hitTest()`, call `setSelected()` and track selected annotation ID
- [ ] 4.4 Handle rectangle deletion — when delete tool active and hit detected, send DELETE API call, detach primitive, refresh annotations
- [x] 4.1 On annotation fetch, create `RectangleDrawingPrimitive` instances for `label_type: "rectangle"` annotations and attach to series
- [x] 4.2 On chart switch, detach old rectangle primitives and create new ones for the new chart's annotations
- [x] 4.3 Handle rectangle selection — on click hit detected via primitive `hitTest()`, call `setSelected()` and track selected annotation ID
- [x] 4.4 Handle rectangle deletion — when delete tool active and hit detected, send DELETE API call, detach primitive, refresh annotations
## 5. Update Toolbox
- [ ] 5.1 Add "rectangle" tool button to Toolbox (using existing `RectangleHorizontal` lucide icon import, which is already present)
- [ ] 5.2 Wire rectangle button to `onToolChange('rectangle')` with same toggle behavior as other tools
- [x] 5.1 Add "rectangle" tool button to Toolbox (using existing `RectangleHorizontal` lucide icon import, which is already present)
- [x] 5.2 Wire rectangle button to `onToolChange('rectangle')` with same toggle behavior as other tools
## 6. Remove SVG Overlay