MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / draw

Method draw

App/GUI/interface/panels/debug/view/DebugView.cpp:43–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void DebugView::draw(float uiScale) {
44 if (customDraw_) {
45 customDraw_(uiScale);
46 return;
47 }
48
49 for (auto& d : data) {
50 const std::string& label = d.entry.label;
51 if (d.entry.type == DebugDisplayType::Value) {
52 const auto& a = std::get<std::any>(d.storage);
53 d.entry.draw(label, a);
54 }
55 else {
56 auto& dq = std::get<std::deque<float>>(d.storage);
57 ImGui::TextDisabled("%s: ", label.data());
58
59 if (!dq.empty()) {
60 ImGui::SameLine();
61 ImGui::Text("%.3f", dq.back());
62 }
63
64 if (dq.size() >= 2) {
65 const auto [minVal, maxVal] = std::ranges::minmax(dq);
66 const float range = (maxVal - minVal) < 1e-6f ? 1.f : (maxVal - minVal);
67
68 ImGui::TextDisabled("%.3f", maxVal);
69
70 std::vector<float> buf(dq.begin(), dq.end());
71 const std::string plotId = "##plot_" + label;
72 ImGui::PlotLines(plotId.data(), buf.data(), static_cast<int>(buf.size()), 0, nullptr, minVal - range * 0.1f,
73 maxVal + range * 0.1f, ImVec2(-1, 60 * uiScale));
74
75 ImGui::TextDisabled("%.3f", minVal);
76 }
77 }
78 ImGui::Separator();
79 }
80}

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected