From 475e3b2c84a9d5bac19b93fb9a8fc6e46e619c75 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Thu, 4 Jun 2026 15:42:36 +0200 Subject: [PATCH] fix(nav/map): don't pin a waypoint to centre in the degenerate trail case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a trail exists but the framed box collapses to one point (e.g. a single recorded point, or all points coincident, with no GPS fix), the degenerate branch was drawing waypoint[0] at the centre — but waypoints aren't folded into the box in trail-priority mode, so a possibly-distant waypoint appeared at the trail's location. Only centre a waypoint in the genuine "lone waypoint, no trail" case. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/TrailScreen.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index f6bee90d..e99bdbf6 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -814,7 +814,11 @@ private: // Degenerate: everything at one coordinate — just centre the markers. if (min_lat == max_lat && min_lon == max_lon) { int ccx = area_x + area_w / 2, ccy = area_y + area_h / 2; - if (nwp > 0) { + // Only pin a waypoint to the centre in the genuine "lone waypoint, no + // trail" case. With a trail the centre is the trail's spot, and the + // waypoints (not folded into this box) belong elsewhere — don't draw + // them here, or they'd appear at the trail's location. + if (nwp > 0 && !have_trail) { drawWaypointMarker(display, ccx, ccy); const char* lbl = wp.at(0).label; // single coincident spot — label it char s[3] = { lbl[0], lbl[0] ? lbl[1] : (char)0, 0 };