feat: add polygon edit geometry and selection transitions
MI
43m ago+361+361+012345678901234567890123456789-1-1-0123456789
What has changed and why?
Part 2 of 9 of STU-240 (draw and edit polygons). Stacked on #3749. Implementation plan
- Polygon editing needs geometry and selection logic that is easy to test.
- Pure functions to move, insert and delete vertices, and to move or delete parts. A part keeps at least 3 vertices.
- Moving a part clamps it to the image only if it fits in the image. Moving one vertex does not clamp the others.
- Selection transitions: annotation → part → vertex. Esc goes up one level. A selection that points past the parts falls back to the annotation level.
- Nothing uses them yet.
How has it been tested?
- Unit tests for each function.
Did you update CHANGELOG.md?
- Yes
- Not needed (internal change)
Summary by CodeRabbit
- New Features
- Added polygon editing capabilities for moving, inserting, and deleting vertices and parts, and translating polygon parts.
- Polygon selections are preserved when switching between vertices in the same part. Selection behavior also adjusts when moving between annotation, part, and vertex levels, or when selected polygon components are no longer available.