Skip to content

Commit

Permalink
fix: reset cursors and statistics on run
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Dec 4, 2024
1 parent 5bbbe76 commit 3b30965
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/Gui/GuiPlotsTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,30 +142,33 @@ class PlotsTree
ImGui::BeginGroup();
ImGui::PushID(plt->getName().c_str());

int32_t listBoxHeight = windowHeight - 30 * GuiHelper::contentScale;

/* Staticstics */
if (plt->getType() == Plot::Type::CURVE)
/* reset markers when viewer is running */
if (viewerDataHandler->getState() == ViewerDataHandler::state::RUN)
{
bool mx0 = plt->markerX0.getState();
bool mx1 = plt->markerX1.getState();
ImGui::Text("x0 marker ");
ImGui::SameLine();
ImGui::Checkbox("##mx0", &mx0);
plt->markerX0.setState(mx0);
ImGui::Text("x1 marker ");
ImGui::SameLine();
ImGui::Checkbox("##mx1", &mx1);
plt->markerX1.setState(mx1);
statisticsWindow.drawAnalog(plt);

listBoxHeight -= 70 * GuiHelper::contentScale;
plt->markerX0.setState(false);
plt->markerX1.setState(false);
plt->statisticsSeries = 0;
}

/* Staticstics */
ImGui::BeginDisabled(plt->getType() != Plot::Type::CURVE);
bool mx0 = plt->markerX0.getState();
bool mx1 = plt->markerX1.getState();
ImGui::Text("x0 marker ");
ImGui::SameLine();
ImGui::Checkbox("##mx0", &mx0);
plt->markerX0.setState(mx0);
ImGui::Text("x1 marker ");
ImGui::SameLine();
ImGui::Checkbox("##mx1", &mx1);
plt->markerX1.setState(mx1);
statisticsWindow.drawAnalog(plt);
ImGui::EndDisabled();
ImGui::PopID();

/* Var list within plot*/
ImGui::PushID("list");
if (ImGui::BeginListBox("##", ImVec2(-1, listBoxHeight)))
if (ImGui::BeginListBox("##", ImVec2(-1, windowHeight - 100 * GuiHelper::contentScale)))
{
std::optional<std::string> seriesNameToDelete = {};
for (auto& [name, ser] : plt->getSeriesMap())
Expand Down

0 comments on commit 3b30965

Please sign in to comment.