From 40fe85f18e699a6e112e38c755335ece2b5510af Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Mon, 19 Jul 2021 12:23:01 +0200 Subject: [PATCH] Nav: only open map once (#21650) old-commit-hash: f9f43578d1b41f97b90f43215ca320bce72e114c --- selfdrive/ui/qt/maps/map.cc | 8 +++++++- selfdrive/ui/qt/maps/map.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/maps/map.cc b/selfdrive/ui/qt/maps/map.cc index 3662f4bbf8..c61cb35345 100644 --- a/selfdrive/ui/qt/maps/map.cc +++ b/selfdrive/ui/qt/maps/map.cc @@ -278,7 +278,12 @@ void MapWindow::recomputeRoute() { if (*new_destination != nav_destination) { qWarning() << "Got new destination from NavDestination param" << *new_destination; - setVisible(true); // Show map on destination set/change + // Only open the map on setting destination the first time + if (allow_open) { + setVisible(true); // Show map on destination set/change + allow_open = false; + } + // TODO: close sidebar should_recompute = true; @@ -375,6 +380,7 @@ void MapWindow::clearRoute() { map_instructions->hideIfNoError(); map_eta->setVisible(false); + allow_open = true; } diff --git a/selfdrive/ui/qt/maps/map.h b/selfdrive/ui/qt/maps/map.h index 7da1024485..a796872b32 100644 --- a/selfdrive/ui/qt/maps/map.h +++ b/selfdrive/ui/qt/maps/map.h @@ -111,6 +111,7 @@ private: bool localizer_valid = false; // Route + bool allow_open = true; bool gps_ok = false; QGeoServiceProvider *geoservice_provider; QGeoRoutingManager *routing_manager;