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 <shane@smiskol.com>
old-commit-hash: 472151b6a0
beeps
pencilpusher 2 years ago committed by GitHub
parent 5ac4f52c6f
commit cc4f6c5fbe
  1. 5
      selfdrive/ui/qt/maps/map.cc

@ -191,6 +191,11 @@ void MapWindow::updateState(const UIState &s) {
carPosSource["type"] = "geojson";
carPosSource["data"] = QVariant::fromValue<QMapbox::Feature>(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) {

Loading…
Cancel
Save