From cc4f6c5fbe24f0412be2ccc1889edc875fea3541 Mon Sep 17 00:00:00 2001 From: pencilpusher <83676301+jakethesnake420@users.noreply.github.com> Date: Wed, 23 Aug 2023 19:33:58 -0500 Subject: [PATCH] ui/map: keep the car icon aligned to its bearing (#29482) * rotate icon with current bearing When user is rotating the map, the car icon should stay fixed on the cars bearing, not the map. * spacing * comment --------- Co-authored-by: Shane Smiskol old-commit-hash: 472151b6a004d387532415039196c2165f7d32df --- selfdrive/ui/qt/maps/map.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/ui/qt/maps/map.cc b/selfdrive/ui/qt/maps/map.cc index d756a777c4..38bcc1a54e 100644 --- a/selfdrive/ui/qt/maps/map.cc +++ b/selfdrive/ui/qt/maps/map.cc @@ -191,6 +191,11 @@ void MapWindow::updateState(const UIState &s) { carPosSource["type"] = "geojson"; carPosSource["data"] = QVariant::fromValue(feature1); m_map->updateSource("carPosSource", carPosSource); + + // Map bearing isn't updated when interacting, keep location marker up to date + if (last_bearing) { + m_map->setLayoutProperty("carPosLayer", "icon-rotate", *last_bearing - m_map->bearing()); + } } if (interaction_counter == 0) {