Option for unit preference#1467
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new “Preferred unit” annotator setting intended to let users force measurement displays (length/area) to a chosen unit instead of automatic selection.
Changes:
- Adds a Preferred unit selector to the annotator settings UI.
- Centralizes available unit names/multipliers in
annotations/utils.jsand updates measurement/scale-line rendering to use them. - Wires the new setting through the settings store and into measurement-related components.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/views/annotations/show/tabs/settings.blade.php | Adds a <select> control for choosing a preferred unit in the settings sidebar. |
| resources/assets/js/annotations/utils.js | Introduces exported UnitNames/UnitMultipliers; updates ScaleLineProperties to optionally use a fixed unit and formats values via Intl.NumberFormat. |
| resources/assets/js/annotations/stores/settings.js | Adds a default value for the new unit preference setting. |
| resources/assets/js/annotations/mixins/measureComponent.vue | Removes local unit arrays (now centralized in utils.js). |
| resources/assets/js/annotations/components/settingsTab.vue | Provides unit list to the template and persists the selected preferred unit via the settings store. |
| resources/assets/js/annotations/components/screenshotButton.vue | Passes preferred unit into ScaleLineProperties when drawing the scale line in screenshots. |
| resources/assets/js/annotations/components/scaleLineIndicator.vue | Passes preferred unit into ScaleLineProperties for the on-canvas scale line indicator. |
| resources/assets/js/annotations/components/measureTooltip.vue | Uses centralized units, reads preferred unit from settings, and updates formatting/unit selection logic. |
| resources/assets/js/annotations/annotatorContainer.vue | Adds handling for preferredUnit changes emitted from the settings tab. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@mzur The preferred unit can be set using a dropdown in the settings tab, where |
Closes #784