Incorrect draft annotation color#1471
Conversation
98628ba to
28ef5af
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses #1468 by ensuring draft annotations (especially for polygon/polygon-brush and magic wand tools) can correctly reflect the selected label color during drawing/editing.
Changes:
- Adds a shared
setOrUnsetProperty()helper to consistently apply or remove feature properties (e.g.,color). - Introduces
draftColorpropagation into polygon brush/modify interactions and the magic wand interaction (plus Vue-side watchers to update it on label/setting changes). - Updates videoScreen and annotationCanvas draw flows to apply/unset draft feature color more consistently.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/assets/js/videos/components/videoScreen/polygonBrushInteractions.vue | Passes draft color into polygon brush/eraser/fill interactions and updates pending draft features when label/setting changes. |
| resources/assets/js/videos/components/videoScreen/drawInteractions.vue | Adds draft color handling for draw interactions (including fallback when setDraftColor is unavailable). |
| resources/assets/js/utils.js | Introduces setOrUnsetProperty() helper and exports it. |
| resources/assets/js/annotations/ol/MagicWandInteraction.js | Adds draftColor support + setDraftColor() to update sketch/indicator feature properties. |
| resources/assets/js/annotations/ol/interaction/PolygonBrush.js | Adds draftColor support + setDraftColor() to color sketch point/feature. |
| resources/assets/js/annotations/ol/interaction/ModifyPolygonBrush.js | Adds draftColor support + setDraftColor() to color the sketch point. |
| resources/assets/js/annotations/components/annotationCanvas/polygonBrushInteraction.vue | Passes draftColor into polygon brush/modify interactions and updates draft color on watchers. |
| resources/assets/js/annotations/components/annotationCanvas/magicWandInteraction.vue | Passes draftColor into magic wand and updates it on label/setting changes. |
| resources/assets/js/annotations/components/annotationCanvas/drawInteractions.vue | Applies/unsets draft color on overlay features during drawing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@mzur Changing the colors of all draw interactions and all pending and current features proved to be quite tedious and repetitive. And it's hard to test the UI in all possible scenarios, but I'm relatively sure I didn't miss anything. Maybe there is a cleaner way to centralize coloring map features? |
|
@mzur A possible improvement of the current architecture would be introducing separate js classes for draw interaction creation (polygon brush, magic wand, etc.) and pending annotation management. Then most of the changes would be limited to these classes instead of being scattered throughout the code base. |
Closes #1468