Skip to content

Commit

Permalink
Fixed first level tree node.
Browse files Browse the repository at this point in the history
  • Loading branch information
prisonerjohn committed Jul 11, 2018
1 parent 74079b8 commit b3ad060
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ bool ofxImGui::BeginTree(ofAbstractParameter& parameter, Settings& settings)
bool ofxImGui::BeginTree(const std::string& name, Settings& settings)
{
bool result;
ImGui::SetNextTreeNodeOpen(true, ImGuiSetCond_Appearing);
if (settings.treeLevel == 0)
{
result = ImGui::TreeNodeEx(GetUniqueName(name), ImGuiTreeNodeFlags_CollapsingHeader);
result = ImGui::CollapsingHeader(GetUniqueName(name));
}
else
{
ImGui::SetNextTreeNodeOpen(true, ImGuiSetCond_Appearing);
result = ImGui::TreeNode(GetUniqueName(name));
}
if (result)
Expand All @@ -164,12 +164,15 @@ bool ofxImGui::BeginTree(const std::string& name, Settings& settings)
//--------------------------------------------------------------
void ofxImGui::EndTree(Settings& settings)
{
if (settings.treeLevel > 1)
{
ImGui::TreePop();
}

settings.treeLevel = std::max(0, settings.treeLevel - 1);

// Clear the list of names from the stack.
windowOpen.usedNames.pop();

ImGui::TreePop();
}

//--------------------------------------------------------------
Expand Down

0 comments on commit b3ad060

Please sign in to comment.