Commit 6e5ac898 authored by w4t's avatar w4t

Fixed first level tree node

parent 572e3252
Pipeline #57 canceled with stages
......@@ -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, ImGuiCond_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)
......@@ -164,12 +164,16 @@ 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();
}
//--------------------------------------------------------------
......@@ -452,9 +456,9 @@ bool ofxImGui::AddParameter(ofParameter<void>& parameter)
//--------------------------------------------------------------
bool ofxImGui::AddRadio(ofParameter<int>& parameter, std::vector<std::string> labels, int columns)
{
//auto uniqueName = GetUniqueName(parameter);
//ImGui::Text(uniqueName);
ImGui::Text("%s", parameter.getName().c_str());
auto uniqueName = GetUniqueName(parameter);
ImGui::Text(uniqueName);
//ImGui::Text("%s", parameter.getName().c_str());
auto result = false;
auto tmpRef = parameter.get();
ImGui::PushID(uniqueName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment