Internals: Nav: Renamed ImGuiNavForward enum (#787)

docking
omar 7 years ago
parent 2933e6765c
commit 1cf38d0334

@ -2896,7 +2896,7 @@ static void ImGui::NavUpdate()
} }
// When a forwarded move request failed, we restore the highlight that we disabled during the forward frame // When a forwarded move request failed, we restore the highlight that we disabled during the forward frame
if (g.NavMoveRequestForward == ImGuiNavForward_ForwardResult) if (g.NavMoveRequestForward == ImGuiNavForward_ForwardActive)
{ {
IM_ASSERT(g.NavMoveRequest); IM_ASSERT(g.NavMoveRequest);
if (g.NavMoveResultId == 0) if (g.NavMoveResultId == 0)
@ -3008,8 +3008,8 @@ static void ImGui::NavUpdate()
{ {
// Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window) // Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window)
IM_ASSERT(g.NavMoveDir != ImGuiDir_None); IM_ASSERT(g.NavMoveDir != ImGuiDir_None);
IM_ASSERT(g.NavMoveRequestForward == ImGuiNavForward_Forwarding); IM_ASSERT(g.NavMoveRequestForward == ImGuiNavForward_ForwardQueued);
g.NavMoveRequestForward = ImGuiNavForward_ForwardResult; g.NavMoveRequestForward = ImGuiNavForward_ForwardActive;
} }
if (g.NavMoveDir != ImGuiDir_None) if (g.NavMoveDir != ImGuiDir_None)
@ -4824,7 +4824,7 @@ static void NavProcessMoveRequestWrapAround(ImGuiWindow* window)
if (g.NavMoveRequest && g.NavWindow == window && g.NavMoveResultId == 0) if (g.NavMoveRequest && g.NavWindow == window && g.NavMoveResultId == 0)
if ((g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) && g.NavMoveRequestForward == ImGuiNavForward_None && g.NavLayer == 0) if ((g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) && g.NavMoveRequestForward == ImGuiNavForward_None && g.NavLayer == 0)
{ {
g.NavMoveRequestForward = ImGuiNavForward_Forwarding; g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued;
NavMoveRequestCancel(); NavMoveRequestCancel();
g.NavWindow->NavRectRel[0].Min.y = g.NavWindow->NavRectRel[0].Max.y = ((g.NavMoveDir == ImGuiDir_Up) ? ImMax(window->SizeFull.y, window->SizeContents.y) : 0.0f) - window->Scroll.y; g.NavWindow->NavRectRel[0].Min.y = g.NavWindow->NavRectRel[0].Max.y = ((g.NavMoveDir == ImGuiDir_Up) ? ImMax(window->SizeFull.y, window->SizeContents.y) : 0.0f) - window->Scroll.y;
} }
@ -10870,7 +10870,7 @@ void ImGui::EndMenuBar()
SetNavIDAndMoveMouse(window->NavLastIds[1], 1, window->NavRectRel[1]); SetNavIDAndMoveMouse(window->NavLastIds[1], 1, window->NavRectRel[1]);
g.NavLayer = 1; g.NavLayer = 1;
g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection. g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection.
g.NavMoveRequestForward = ImGuiNavForward_Forwarding; g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued;
NavMoveRequestCancel(); NavMoveRequestCancel();
} }
} }

@ -295,8 +295,8 @@ enum ImGuiNavDirSourceFlags_
enum ImGuiNavForward enum ImGuiNavForward
{ {
ImGuiNavForward_None, ImGuiNavForward_None,
ImGuiNavForward_Forwarding, ImGuiNavForward_ForwardQueued,
ImGuiNavForward_ForwardResult ImGuiNavForward_ForwardActive
}; };
// 2D axis aligned bounding-box // 2D axis aligned bounding-box
@ -617,7 +617,7 @@ struct ImGuiContext
bool NavInitResultExplicit; // Whether the result was explicitly requested with SetItemDefaultFocus() bool NavInitResultExplicit; // Whether the result was explicitly requested with SetItemDefaultFocus()
bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items
bool NavMoveRequest; // Move request for this frame bool NavMoveRequest; // Move request for this frame
ImGuiNavForward NavMoveRequestForward; // No forward / Forwarding / ForwardResult (this is used to navigate sibling parent menus from a child menu) ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down) ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
ImGuiDir NavMoveDirLast; // Direction of the previous move request ImGuiDir NavMoveDirLast; // Direction of the previous move request
ImGuiID NavMoveResultId; // Best move request candidate ImGuiID NavMoveResultId; // Best move request candidate

Loading…
Cancel
Save