Skip to content

Commit

Permalink
fix: fixed plot and group selection in tree
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Dec 4, 2024
1 parent 3b30965 commit 689af31
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Gui/GuiPlotsTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class PlotsTree
if (!plotHandler->checkIfPlotExists(selectedPlot))
selectedPlot = plotGroupHandler->getActiveGroup()->begin()->second.plot->getName();

if (!plotGroupHandler->checkIfGroupExists(selectedGroup))
selectedGroup = plotGroupHandler->getActiveGroup()->getName();

ImGui::BeginChild("Plot Tree", ImVec2(-1, windowHeight));
ImGui::BeginChild("left pane", ImVec2(200 * GuiHelper::contentScale, -1), true);

Expand Down Expand Up @@ -93,7 +96,9 @@ class PlotsTree
ImGui::Checkbox(std::string("##" + name).c_str(), (bool*)&plotElem.visibility);
ImGui::SameLine();

if (ImGui::Selectable(name.c_str(), selectedPlot == name, ImGuiSelectableFlags_AllowDoubleClick))
bool shouldSelect = (selectedPlot == name && plotGroupHandler->getActiveGroup() == group);

if (ImGui::Selectable(name.c_str(), shouldSelect, ImGuiSelectableFlags_AllowDoubleClick))
{
selectedPlot = name;

Expand Down

0 comments on commit 689af31

Please sign in to comment.