From df894eba167a815b5937fce2881bf8087bba679a Mon Sep 17 00:00:00 2001 From: MarekZegare4 Date: Mon, 22 Jun 2026 14:25:09 +0200 Subject: [PATCH] fix(map): label live contacts before waypoints so the person's name shows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The label collision-avoidance reserved waypoint label slots first, so a tracked contact's name was dropped whenever it sat near a waypoint — leaving only the waypoint label. Label live-tracked contacts first: on a live map the moving person's name should win the slot over a nearby static waypoint. Verified: WioTrackerL1_companion_solo_dual builds clean. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/TrailScreen.h | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index f60e16f1..e8a15321 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -579,18 +579,9 @@ private: const int wp_x_max = area_x + area_w - 1, wp_y_max = area_y + area_h - 1; // Reserved rectangles of labels already placed this frame, so a dense // cluster of points doesn't smear their labels on top of one another. + // Live-tracked contacts are labelled FIRST so a moving person's name wins a + // slot over a nearby static waypoint (on a live map the person matters most). LblRect occ[40]; int nocc = 0; - for (int i = 0; i < wp.count(); i++) { - const Waypoint& w = wp.at(i); - int wx, wy; proj.project(w.lat_1e6, w.lon_1e6, wx, wy); - if (wx < area_x) wx = area_x; else if (wx > wp_x_max) wx = wp_x_max; - if (wy < area_y) wy = area_y; else if (wy > wp_y_max) wy = wp_y_max; - drawWaypointMarker(display, wx, wy); - char s[3] = { w.label[0], w.label[0] ? w.label[1] : (char)0, 0 }; - drawLabelAvoiding(display, s, wx, wy, area_x, area_y, area_w, area_h, occ, nocc, 40); - } - // Live-tracked contacts ([LOC] shares): filled diamond + name initial, - // clamped to the frame like waypoints. { LiveTrackStore& lt = _task->liveTrack(); uint32_t now = rtc_clock.getCurrentTime(); @@ -605,6 +596,15 @@ private: drawLabelAvoiding(display, s2, cx, cy, area_x, area_y, area_w, area_h, occ, nocc, 40); } } + for (int i = 0; i < wp.count(); i++) { + const Waypoint& w = wp.at(i); + int wx, wy; proj.project(w.lat_1e6, w.lon_1e6, wx, wy); + if (wx < area_x) wx = area_x; else if (wx > wp_x_max) wx = wp_x_max; + if (wy < area_y) wy = area_y; else if (wy > wp_y_max) wy = wp_y_max; + drawWaypointMarker(display, wx, wy); + char s[3] = { w.label[0], w.label[0] ? w.label[1] : (char)0, 0 }; + drawLabelAvoiding(display, s, wx, wy, area_x, area_y, area_w, area_h, occ, nocc, 40); + } if (have_gps) { int mx, my; proj.project(my_lat, my_lon, mx, my);