Skip to content

Commit

Permalink
Fixes collapsible headers conflicting when toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
fadillzzz committed Apr 5, 2024
1 parent 0579e20 commit 76147b1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/feats/chain_logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ namespace Feats {

void tick() { return; }

void renderStack(Logger::Chain::Call &call, bool isRoot = false) {
void renderStack(Logger::Chain::Call &call, bool isRoot = false, std::string index = "") {
const auto childCount = std::get<uint64_t>(call.attributes["childCount"]);
std::string header = call.funcName + " (" + std::to_string(childCount + 1) + " calls)";

bool shouldRender = true;

if (childCount > 0) {
if (isRoot) {
shouldRender = ImGui::CollapsingHeader(header.c_str());
shouldRender = ImGui::CollapsingHeader((index + header).c_str());
} else {
shouldRender = ImGui::TreeNode(header.c_str());
shouldRender = ImGui::TreeNode((index + header).c_str());
}
}

Expand Down Expand Up @@ -75,8 +75,9 @@ namespace Feats {
ImGui::Text(call.funcName.c_str());
ImGui::PopStyleColor();

for (auto &child : call.children) {
renderStack(child);
for (auto i = 1; auto &child : call.children) {
renderStack(child, false, index + std::to_string(i) + ".");
i++;
}

ImGui::Unindent();
Expand Down Expand Up @@ -120,8 +121,9 @@ namespace Feats {
return;
}

for (auto &log : logs) {
renderStack(log, true);
for (auto i = 1; auto &log : logs) {
renderStack(log, true, std::to_string(i) + ".");
i++;
}
}
} // namespace ChainLogging
Expand Down

0 comments on commit 76147b1

Please sign in to comment.