From 2ae3598b51829b4fbed16605739bae272c90e1b2 Mon Sep 17 00:00:00 2001 From: Trey Moen <50057480+greatgitsby@users.noreply.github.com> Date: Sun, 13 Sep 2026 15:56:21 -0700 Subject: [PATCH] cabana: prevent signal panel collapse (#38903) * cabana: keep signal scrolling inside the list * cabana: reserve space for the signal panel --- openpilot/tools/cabana/ui/widgets/detailwidget.cc | 7 ++++--- openpilot/tools/cabana/ui/widgets/signalview.cc | 13 ++++++++++--- openpilot/tools/cabana/ui/widgets/signalview.h | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/openpilot/tools/cabana/ui/widgets/detailwidget.cc b/openpilot/tools/cabana/ui/widgets/detailwidget.cc index 988cf4b3cb..8f42b63d80 100644 --- a/openpilot/tools/cabana/ui/widgets/detailwidget.cc +++ b/openpilot/tools/cabana/ui/widgets/detailwidget.cc @@ -218,16 +218,17 @@ void DetailWidget::drawTabWidget() { ImGui::BeginChild("page", ImVec2(0, std::max(page_rect.GetHeight() - pill_height - gap, 1.0f)), ImGuiChildFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); if (tab_widget_index_ == 0) { - // binary_view_ keeps its size hint, signal_view_ takes the rest + // Reserve the signal toolbar and rows before giving the byte grid its preferred height. const float min_height = binary_view_->minimumSizeHint().y; const float avail = ImGui::GetContentRegionAvail().y; - const float max_height = std::max(avail - style.ItemSpacing.y - 1.0f, 1.0f); + const float max_height = std::max(avail - style.ItemSpacing.y - SignalView::minimumHeight(), 1.0f); const float height = std::clamp(min_height, 1.0f, max_height); ImGui::BeginChild("binary_view", ImVec2(0, height), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar); binary_view_rect_ = ImGui::GetCurrentWindow()->Rect(); binary_view_->draw(); ImGui::EndChild(); - ImGui::BeginChild("signal_view", ImVec2(0, 0)); + ImGui::BeginChild("signal_view", ImVec2(0, 0), ImGuiChildFlags_None, + ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); signal_view_rect_ = ImGui::GetCurrentWindow()->Rect(); signal_view_->draw(); ImGui::EndChild(); diff --git a/openpilot/tools/cabana/ui/widgets/signalview.cc b/openpilot/tools/cabana/ui/widgets/signalview.cc index 269df6158c..48a74fd111 100644 --- a/openpilot/tools/cabana/ui/widgets/signalview.cc +++ b/openpilot/tools/cabana/ui/widgets/signalview.cc @@ -690,9 +690,16 @@ float SignalView::minimumWidth() { return left_width + style.ItemSpacing.x + toolBarRightWidth("00:00") + (style.WindowPadding.x + style.ChildBorderSize) * 2; } +float SignalView::minimumHeight() { + const ImGuiStyle &style = ImGui::GetStyle(); + return ImGui::GetFrameHeight() + style.ItemSpacing.y + signalRowHeight() * 3 + + (style.WindowPadding.y + style.ChildBorderSize + CONTROL_OUTLINE_PADDING) * 2; +} + void SignalView::draw() { ImGui::PushStyleColor(ImGuiCol_ChildBg, palette().surface); - if (!ImGui::BeginChild("SignalView", ImVec2(0, 0), ImGuiChildFlags_Borders)) { + if (!ImGui::BeginChild("SignalView", ImVec2(0, 0), ImGuiChildFlags_Borders, + ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { ImGui::EndChild(); ImGui::PopStyleColor(); return; @@ -740,8 +747,8 @@ void SignalView::collapseAll() { void SignalView::drawTree() { ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, 0.0f)); - const float min_height = std::max(ImGui::GetContentRegionAvail().y, 300.0f); - const bool visible = beginControlChild("tree", ImVec2(0, min_height)); + // Keep the toolbar fixed; only the signal rows scroll within the remaining space. + const bool visible = beginControlChild("tree", ImVec2(0, 0)); if (visible) { DrawContext ctx{ImGui::GetWindowDrawList(), ImGui::GetCursorScreenPos().x, ImGui::GetContentRegionAvail().x, rowHeight()}; // the press that closes an open editor is consumed by the focus change, the index widgets never see it diff --git a/openpilot/tools/cabana/ui/widgets/signalview.h b/openpilot/tools/cabana/ui/widgets/signalview.h index dc77ad7b37..d6ba246097 100644 --- a/openpilot/tools/cabana/ui/widgets/signalview.h +++ b/openpilot/tools/cabana/ui/widgets/signalview.h @@ -110,6 +110,7 @@ public: void setMessage(const MessageId &id); void draw(); static float minimumWidth(); + static float minimumHeight(); void signalHovered(const cabana::Signal *sig); // handler for BinaryView::signalHovered void updateChartState(); void selectSignal(const cabana::Signal *sig, bool expand = false);