Nav: Failed movement request with no current NavId fallback to an InitDefaultRequest so that we always land somewhere on first move (#323)

This commit is contained in:
ocornut 2016-08-07 13:34:25 +02:00
parent 5ef8452509
commit 8a6d209f68

View File

@ -2664,6 +2664,14 @@ static void NavUpdate()
if (g.NavMoveDir != ImGuiNavDir_None) if (g.NavMoveDir != ImGuiNavDir_None)
g.NavMoveRequest = true; g.NavMoveRequest = true;
// If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
if (g.NavMoveRequest && g.NavId == 0)
{
g.NavInitDefaultRequest = g.NavInitDefaultResultExplicit = true;
g.NavInitDefaultResultId = 0;
g.NavDisableHighlight = false;
}
// Scrolling // Scrolling
if (g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.NavWindowingTarget) if (g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.NavWindowingTarget)
{ {