waypoints: cleanup

master
Pavel Machek 2024-11-23 10:14:35 +01:00
parent 6df1d33b27
commit 673bcc35d5
1 changed files with 2 additions and 13 deletions

View File

@ -196,24 +196,13 @@ let arrow = {
this.waypoint.lon = lon; this.waypoint.lon = lon;
}, },
// Calculate the bearing to the waypoint
bearingToWaypoint: function(currentPos) {
return fmt.bearing(currentPos, this.waypoint);
},
// Calculate distance to the waypoint
distanceToWaypoint: function(currentPos) {
return fmt.distance(currentPos, this.waypoint);
},
// Display function to show arrows for waypoint, north, and sun // Display function to show arrows for waypoint, north, and sun
draw: function(currentPos) { draw: function(currentPos) {
let currentHeading = currentPos.course; let currentHeading = currentPos.course;
g.clear().setFont("Vector", 22).setFontAlign(0, 0); g.clear().setFont("Vector", 22).setFontAlign(0, 0);
// Calculate bearings let waypointBearing = fmt.bearing(currentPos, this.waypoint);
let waypointBearing = this.bearingToWaypoint(currentPos); let distance = fmt.distance(currentPos, this.waypoint);
let distance = this.distanceToWaypoint(currentPos);
northHeading = 0; northHeading = 0;