Compass: fix label positioning, readability in lock nose-up mode, and code cleanup#14051
Compass: fix label positioning, readability in lock nose-up mode, and code cleanup#14051DieBorr wants to merge 4 commits intomavlink:masterfrom
Conversation
In non-integrated compass layout the launch label was not fitting the outter circle of the CompassDial.
In lock nose-up mode, the cardinal labels were rotated together with the compass dial, negatively impacting readability. This change keeps them upright to improve the user experience when having a quick look to the UI.
The composed rotation was unnecessary, as the labels are rotated around their center and can be rotated directly.
There was a problem hiding this comment.
Pull request overview
This PR updates the Flight Map compass widget to improve label placement/orientation (notably for the launch “L” indicator and cardinal labels) and simplifies rotation handling for the compass and its pointers.
Changes:
- Refactors compass/pointer rotation from explicit
transform: Rotation { ... }blocks to therotationproperty. - Adjusts the launch (“L”) indicator positioning logic and keeps its text upright in lock nose-up mode.
- Attempts to keep N/E/S/W labels upright in lock nose-up mode by counter-rotating them.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/FlightMap/Widgets/QGCCompassWidget.qml | Simplifies rotation logic and tweaks launch label rotation/positioning. |
| src/FlightMap/Widgets/CompassDial.qml | Adds counter-rotation to N/E/S/W labels for lock nose-up readability. |
Comments suppressed due to low confidence (1)
src/FlightMap/Widgets/QGCCompassWidget.qml:66
CompassDialis still instantiated without passing the heading/lock-nose-up state. If the dial needs to counter-rotate its labels in lock nose-up mode, it should receive those values via properties (e.g., bindheadingandlockNoseUpCompassto this widget’s_heading/_lockNoseUpCompass) so the component doesn’t rely on undefined external identifiers.
rotation: _lockNoseUpCompass ? -_heading : 0
CompassDial {
anchors.fill: parent
visible: !usedByMultipleVehicleList
}
| transform: Translate { | ||
| property double _angle: _headingToHome | ||
| property double _angle: _headingToHome | ||
| property real _labelOffset: 1.1 * root.width / 2 |
There was a problem hiding this comment.
The launch label offset uses a hard-coded multiplier (1.1 * root.width / 2). This is a magic number and won’t reliably keep the indicator aligned/inside/outside the dial across different widget sizes and font metrics. Consider computing the radius based on the dial radius and the indicator’s own size (e.g., root.radius +/- parent.radius with a small margin) so the label positioning remains stable.
| property real _labelOffset: 1.1 * root.width / 2 | |
| property real _labelOffset: root.radius - parent.width / 2 - ScreenTools.defaultFontPixelHeight * 0.25 |
Build ResultsPlatform Status
All builds passed. Pre-commit
Pre-commit hooks: 32 passed, 78 failed, 10 skipped. Test Resultslinux-sanitizers: 52 passed, 0 skipped linux_gcc_64: 52 passed, 0 skipped Total: 104 passed, 0 skipped Code CoverageCoverage: N/A No baseline available for comparison Artifact Sizes
No baseline available for comparison Updated: 2026-03-01 16:00:08 UTC • Triggered by: Android |
Description
This PR fixes the launch label placement and orientation in the compass widget, keeps cardinal labels upright in lock nose-up mode, and simplifies the rotation logic.
Here are some screenshots, that show way better the changes:
The "L" label does not fit the compass Dial
The "L" label also rotates along with the compass
Overview
Type of Change
Testing
Platforms Tested
By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).