aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseniy Movshev <dodoradio@outlook.com>2023-11-24 17:13:46 +0000
committerArseniy Movshev <dodoradio@outlook.com>2023-11-24 17:20:18 +0000
commit298ed17d1450b3590d3702e446c5f61aca9fa6b0 (patch)
tree12b383819e1e94e7a7063a3387462eec58ce6c76 /src
parent34f0cb81fe8f6133c5d6d5c26af69486aa6d24ef (diff)
Compass: add text heading and stop cardinal directions spinning. - adds a heading (eg. NE, NNW) below the numeric bearing. This may be useful for reading the bearing if looking at the watch off-axis. - removes counter-rotation from cardinal directions. This change is made with the intention of improving accessibility - I personally believe that the counter-rotating letters were distracting and visually noisy, and weren't helpful if looking at the watch off-axis.HEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/Compass.qml27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/Compass.qml b/src/Compass.qml
index 48e9557..040824a 100644
--- a/src/Compass.qml
+++ b/src/Compass.qml
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2022 - Darrel Griët <dgriet@gmail.com>
+ * Copyright (C) 2023 - Arseniy Movshev <dodoradio@outlook.com>
+ * 2022 - Darrel Griët <dgriet@gmail.com>
* 2017 - Florent Revest <revestflo@gmail.com>
* - Niels Tholenaar <info@123quality.nl>
*
@@ -53,10 +54,11 @@ Item {
anchors.fill: parent
Label {
id: magneticRotation
- anchors.centerIn: parent
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.verticalCenter
text: compassRoot.rotation
font {
- pixelSize: parent.height / 4
+ pixelSize: parent.height / 6
capitalization: Font.Capitalize
styleName: "SemiCondensed"
kerning: true
@@ -69,7 +71,21 @@ Item {
anchors.left: magneticRotation.right
text: "°"
font {
- pixelSize: parent.height / 4
+ pixelSize: parent.height / 6
+ capitalization: Font.Capitalize
+ styleName: "SemiCondensed"
+ kerning: true
+ preferShaping: true
+ }
+ }
+ Label {
+ id: letterHeading
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: magneticRotation.bottom
+ property var cardinalDirectionsExt: ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
+ text: cardinalDirectionsExt[Math.floor((compassRoot.rotation+11.25)/22.5)]
+ font {
+ pixelSize: parent.height / 6
capitalization: Font.Capitalize
styleName: "SemiCondensed"
kerning: true
@@ -96,7 +112,7 @@ Item {
Label {
property var angle: (index / outerRing.count) * 2 * Math.PI
property var cardinalDirections: ["N", "NE", "E", "SE", "S", "SW", "W", "NW"]
- rotation: compassRoot.rotation
+ rotation: index*45
color: index == 0 ? "#c2620c" : "white"
text: cardinalDirections[index]
anchors {
@@ -116,3 +132,4 @@ Item {
}
}
}
+