From b249a21e2f8bf91647674b61eeb9eb95b0d20ac2 Mon Sep 17 00:00:00 2001 From: Piotr Wasilewski Date: Sun, 8 Dec 2024 06:27:04 +0100 Subject: [PATCH] fix: fixed table view cell height --- .../MCUViewer_test/MCUViewer_project/MCUViewer_test.cfg | 8 ++++---- src/Gui/GuiPlots.cpp | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/example/MCUViewer_test/MCUViewer_project/MCUViewer_test.cfg b/example/MCUViewer_test/MCUViewer_project/MCUViewer_test.cfg index e3d469de..b3b5b449 100644 --- a/example/MCUViewer_test/MCUViewer_project/MCUViewer_test.cfg +++ b/example/MCUViewer_test/MCUViewer_project/MCUViewer_test.cfg @@ -298,7 +298,7 @@ format = HEX [plot1-series3] name = test.structA.c -visibility = false +visibility = true format = DEC [plot1-series4] @@ -308,7 +308,7 @@ format = DEC [plot1-series5] name = test.structA.g -visibility = false +visibility = true format = DEC [plot1-series6] @@ -533,11 +533,11 @@ visibility = true [group0-plot1] name = settings -visibility = false +visibility = true [group0-plot2] name = sine signals -visibility = false +visibility = true [group0-plot3] name = triangle diff --git a/src/Gui/GuiPlots.cpp b/src/Gui/GuiPlots.cpp index 631a0499..ac2b2c6f 100644 --- a/src/Gui/GuiPlots.cpp +++ b/src/Gui/GuiPlots.cpp @@ -254,6 +254,7 @@ void Gui::drawPlotTable(std::shared_ptr plot) ImGui::SetCursorPosX((ImGui::GetWindowSize().x - ImGui::CalcTextSize(plot->getName().c_str()).x) * 0.5f); ImGui::Text("%s", plot->getName().c_str()); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f)); // Adjust vertical padding if (ImGui::BeginTable(plot->getName().c_str(), 4, flags)) { ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible @@ -298,6 +299,7 @@ void Gui::drawPlotTable(std::shared_ptr plot) if (viewerDataHandler->getState() == DataHandlerBase::State::STOP) { ImGui::PopStyleColor(3); + ImGui::EndDisabled(); continue; } if (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)) @@ -325,6 +327,7 @@ void Gui::drawPlotTable(std::shared_ptr plot) ImGui::EndDragDropTarget(); } } + ImGui::PopStyleVar(); plot->setIsHovered(ImGui::IsItemHovered()); }