mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 23:08:11 +00:00
fix(map): label live contacts before waypoints so the person's name shows
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user