From c1af501cc4814cc784e6959ee8f6a1b8d4cf764d Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Mon, 26 Oct 2026 20:42:36 +0100 Subject: [PATCH] fix(l2): a map line starts from the middle of the own-position and node dots Co-Authored-By: Claude Opus 5.5 --- examples/companion_radio/ui-lvgl/MapScreen.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/companion_radio/ui-lvgl/MapScreen.h b/examples/companion_radio/ui-lvgl/MapScreen.h index ec998c85..a881e8de 100644 --- a/examples/companion_radio/ui-lvgl/MapScreen.h +++ b/examples/companion_radio/ui-lvgl/MapScreen.h @@ -553,7 +553,7 @@ static void drawMarks(lv_event_t* e) { const Mark& m = s_marks[k]; if (!m.vis) continue; dot.bg_color = lv_color_hex(m.col); - lv_area_t da = { a.x1 + m.x - half, a.y1 + m.y - half, a.x1 + m.x + half - 1, a.y1 + m.y + half - 1 }; + lv_area_t da = { a.x1 + m.x - half, a.y1 + m.y - half, a.x1 + m.x + half, a.y1 + m.y + half }; // odd: centred on (x, y), as the lines are lv_draw_rect(layer, &dot, &da); } // Hop numbers of the route being picked: a badge at the dot's top right. @@ -811,7 +811,7 @@ void UITask::buildMap() { _map_me = lv_obj_create(_map_marks); lv_obj_remove_style_all(_map_me); - lv_obj_set_size(_map_me, 16, 16); + lv_obj_set_size(_map_me, 17, 17); // odd: its middle on the pixel a route line starts from lv_obj_set_style_radius(_map_me, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_bg_color(_map_me, lv_color_hex(theme::ACCENT), 0); lv_obj_set_style_bg_opa(_map_me, LV_OPA_COVER, 0); @@ -992,7 +992,7 @@ void UITask::layoutMap() { if (_core->course.currentLocation(lat, lon)) { double x = mapview::lonToTileX(lon / 1e6, _map_z) * mapview::TILE_PX - left; double y = mapview::latToTileY(lat / 1e6, _map_z) * mapview::TILE_PX - top; - lv_obj_set_pos(_map_me, (int)x - 8, (int)y - 8); + lv_obj_set_pos(_map_me, (int)lround(x) - 8, (int)lround(y) - 8); lv_obj_remove_flag(_map_me, LV_OBJ_FLAG_HIDDEN); } else { lv_obj_add_flag(_map_me, LV_OBJ_FLAG_HIDDEN);