mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
This commit is contained in:
29
imgui.cpp
29
imgui.cpp
@ -7044,14 +7044,31 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
ImGuiButtonFlags button_flags = ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowOverlapMode) ? ImGuiButtonFlags_AllowOverlapMode : 0);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0);
|
||||
|
||||
bool hovered, held, pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags);
|
||||
if (pressed && !(flags & ImGuiTreeNodeFlags_Leaf))
|
||||
if (!(flags & ImGuiTreeNodeFlags_Leaf))
|
||||
{
|
||||
bool toggled = !(flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) || (g.NavActivateId == id);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnArrow)
|
||||
toggled |= IsMouseHoveringRect(interact_bb.Min, ImVec2(interact_bb.Min.x + text_offset_x, interact_bb.Max.y)) && (!g.NavDisableMouseHover);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
toggled |= g.IO.MouseDoubleClicked[0];
|
||||
bool toggled = false;
|
||||
if (pressed)
|
||||
{
|
||||
toggled = !(flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) || (g.NavActivateId == id);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnArrow)
|
||||
toggled |= IsMouseHoveringRect(interact_bb.Min, ImVec2(interact_bb.Min.x + text_offset_x, interact_bb.Max.y)) && (!g.NavDisableMouseHover);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
toggled |= g.IO.MouseDoubleClicked[0];
|
||||
}
|
||||
|
||||
if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open)
|
||||
{
|
||||
toggled = true;
|
||||
g.NavMoveRequest = false;
|
||||
}
|
||||
if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority?
|
||||
{
|
||||
toggled = true;
|
||||
g.NavMoveRequest = false;
|
||||
}
|
||||
|
||||
if (toggled)
|
||||
{
|
||||
is_open = !is_open;
|
||||
|
Reference in New Issue
Block a user