mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-23 02:04:22 +00:00
Nav: small refactor of forwarding, clarified that MoveDir only set when RequestActive, removed one indent level in NavUpdatePageUpPageDown().
This commit is contained in:
parent
4351febe9f
commit
ccfb20095e
3 changed files with 77 additions and 83 deletions
|
|
@ -5897,12 +5897,12 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||
toggled = true;
|
||||
}
|
||||
|
||||
if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open)
|
||||
if (g.NavId == id && g.NavMoveDir == ImGuiDir_Left && is_open)
|
||||
{
|
||||
toggled = true;
|
||||
NavMoveRequestCancel();
|
||||
}
|
||||
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?
|
||||
if (g.NavId == id && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority?
|
||||
{
|
||||
toggled = true;
|
||||
NavMoveRequestCancel();
|
||||
|
|
@ -6690,7 +6690,7 @@ void ImGui::EndMenuBar()
|
|||
ImGuiWindow* nav_earliest_child = g.NavWindow;
|
||||
while (nav_earliest_child->ParentWindow && (nav_earliest_child->ParentWindow->Flags & ImGuiWindowFlags_ChildMenu))
|
||||
nav_earliest_child = nav_earliest_child->ParentWindow;
|
||||
if (nav_earliest_child->ParentWindow == window && nav_earliest_child->DC.ParentLayoutType == ImGuiLayoutType_Horizontal && g.NavMoveRequestForward == ImGuiNavForward_None)
|
||||
if (nav_earliest_child->ParentWindow == window && nav_earliest_child->DC.ParentLayoutType == ImGuiLayoutType_Horizontal && (g.NavMoveRequestFlags & ImGuiNavMoveFlags_Forwarded) == 0)
|
||||
{
|
||||
// To do so we claim focus back, restore NavId and then process the movement request for yet another frame.
|
||||
// This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth bothering)
|
||||
|
|
@ -6910,7 +6910,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|||
want_close = menu_is_open;
|
||||
want_open = !menu_is_open;
|
||||
}
|
||||
if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right) // Nav-Right to open
|
||||
if (g.NavId == id && g.NavMoveDir == ImGuiDir_Right) // Nav-Right to open
|
||||
{
|
||||
want_open = true;
|
||||
NavMoveRequestCancel();
|
||||
|
|
@ -6928,7 +6928,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|||
{
|
||||
want_open = true;
|
||||
}
|
||||
else if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Down) // Nav-Down to open
|
||||
else if (g.NavId == id && g.NavMoveDir == ImGuiDir_Down) // Nav-Down to open
|
||||
{
|
||||
want_open = true;
|
||||
NavMoveRequestCancel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue