FrogPilot setup - Determine if the map is open

This commit is contained in:
FrogAi 2024-06-07 04:11:50 -07:00
parent 33cf1114dd
commit 370d62789d
2 changed files with 7 additions and 0 deletions

View File

@ -55,6 +55,7 @@ void HomeWindow::showSidebar(bool show) {
void HomeWindow::showMapPanel(bool show) {
onroad->showMapPanel(show);
uiState()->scene.map_open = true;
}
void HomeWindow::updateState(const UIState &s) {
@ -74,6 +75,7 @@ void HomeWindow::offroadTransition(bool offroad) {
slayout->setCurrentWidget(home);
} else {
slayout->setCurrentWidget(onroad);
uiState()->scene.map_open = onroad->isMapVisible();
}
}
@ -91,6 +93,7 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) {
// Handle sidebar collapsing
if ((onroad->isVisible() || body->isVisible()) && (!sidebar->isVisible() || e->x() > sidebar->width())) {
sidebar->setVisible(!sidebar->isVisible() && !onroad->isMapVisible());
uiState()->scene.map_open = onroad->isMapVisible();
}
}

View File

@ -101,6 +101,10 @@ typedef struct UIScene {
bool started, ignition, is_metric, map_on_left, longitudinal_control;
bool world_objects_visible = false;
uint64_t started_frame;
// FrogPilot variables
bool map_open;
} UIScene;
class UIState : public QObject {