#4 next nav point name display

This commit is contained in:
2023-11-05 17:33:25 +01:00
parent 8069e80ce1
commit 6090e7e5db
8 changed files with 112 additions and 20 deletions
+30 -17
View File
@@ -9,6 +9,9 @@ class Track extends WatchUi.Drawable {
hidden var _toNextPoint as Float;
hidden var _distance as Float;
hidden var _offCourse as Float;
hidden var _nextPointName as String;
hidden var _showNextPoint as Boolean;
hidden var _font;
function initialize() {
var dictionary = {
@@ -21,29 +24,23 @@ class Track extends WatchUi.Drawable {
_toNextPoint = 0.0f;
_distance = 0.0f;
_offCourse = 0.0f;
_nextPointName = "";
_showNextPoint = true;
if (Graphics has :getVectorFont) {
_font = Graphics.getVectorFont({:face => "RobotoCondensedRegular", :size => 24});
} else {
_font = null;
}
}
function setToDestination(tdst as Float) as Void {
_toDestination = tdst;
}
function setToNextPoint(tnp as Float) as Void {
_toNextPoint = tnp;
}
function setDistance(dst as Float) as Void {
_distance = dst;
}
function setOffCourse(off as Float) as Void {
_offCourse = off;
}
function setTrackData(tdst as Float, tnp as Float, dst as Float, off as Float) as Void {
function setTrackData(tdst as Float, tnp as Float, dst as Float, off as Float, nextPointName as String, showNextPoint as Boolean) as Void {
_toDestination = tdst;
_toNextPoint = tnp;
_distance = dst;
_offCourse = off;
_nextPointName = nextPointName;
_showNextPoint = showNextPoint;
}
function draw(dc as Dc) as Void {
@@ -105,6 +102,22 @@ class Track extends WatchUi.Drawable {
dc.setPenWidth((dc.getWidth() * 0.01).toNumber());
dc.setColor(0xFFFF00, Graphics.COLOR_TRANSPARENT);
dc.drawArc(w / 2, h / 2, w / 2 - 2, Graphics.ARC_COUNTER_CLOCKWISE, acurrent, anext);
// next point name
if (_showNextPoint && _font != null && h > 350) {
var pointText = (_toNextPoint / 1000.0).format("%.1f");
if (_nextPointName.length() > 0 && _nextPointName.length() <= 20) {
pointText += " | " + _nextPointName;
} else if (_nextPointName.length() > 20) {
pointText += " | " + _nextPointName.substring(0, 17) + "...";
}
if (_toNextPoint > 1000) {
dc.setColor(0x88FFFF, Graphics.COLOR_TRANSPARENT);
} else {
dc.setColor(0xAAFF44, Graphics.COLOR_TRANSPARENT);
}
dc.drawRadialText(w / 2, h / 2, _font, pointText, Graphics.TEXT_JUSTIFY_CENTER, 270, h / 2 - 12, Graphics.RADIAL_TEXT_DIRECTION_COUNTER_CLOCKWISE);
}
}
}
}
+3 -1
View File
@@ -44,6 +44,7 @@ class RepaFieldView extends WatchUi.DataField {
hidden var themeColor3 as Number;
hidden var hrDisplayType as Number;
hidden var speedNotPace as Boolean;
hidden var showNextPoint as Boolean;
hidden var tlFieldData as Number;
hidden var hrZones as Array<Number>;
hidden var hrHist as Array<Number>;
@@ -109,6 +110,7 @@ class RepaFieldView extends WatchUi.DataField {
themeColor3 = Application.Properties.getValue("themeColor3").toNumberWithBase(16);
hrDisplayType = Application.Properties.getValue("hrDisplay").toNumber();
speedNotPace = Application.Properties.getValue("speedNotPace");
showNextPoint = Application.Properties.getValue("showNextPoint");
tlFieldData = Application.Properties.getValue("tlFieldData").toNumber();
hrValue = 0;
@@ -404,7 +406,7 @@ class RepaFieldView extends WatchUi.DataField {
// track
if (fTrack != null) {
fTrack.setTrackData(toDestination, toNextPoint, distance, offCourse);
fTrack.setTrackData(toDestination, toNextPoint, distance, offCourse, nextPointName, showNextPoint);
}
// time