Nav: Minor tweaks in NavProcessItem() used by ItemAdd()

docking
omar 7 years ago
parent c3105919ba
commit d91b093be6

@ -2191,16 +2191,15 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGu
} }
// Scoring for navigation // Scoring for navigation
bool new_best = false; if (g.NavId != id)
{
#if IMGUI_DEBUG_NAV #if IMGUI_DEBUG_NAV
// [DEBUG] Score items at all times // [DEBUG] Score all items in NavWindow at all times
if (!g.NavMoveRequest) if (!g.NavMoveRequest)
g.NavMoveDir = g.NavMoveDirLast; g.NavMoveDir = g.NavMoveDirLast;
if (g.NavId != id) bool new_best = NavScoreItem(nav_bb) && g.NavMoveRequest;
new_best = NavScoreItem(nav_bb) && g.NavMoveRequest;
#else #else
if (g.NavMoveRequest && g.NavId != id) bool new_best = g.NavMoveRequest && NavScoreItem(nav_bb);
new_best = NavScoreItem(nav_bb);
#endif #endif
if (new_best) if (new_best)
{ {
@ -2208,6 +2207,7 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGu
g.NavMoveResultParentId = window->IDStack.back(); g.NavMoveResultParentId = window->IDStack.back();
g.NavMoveResultRectRel = nav_bb_rel; g.NavMoveResultRectRel = nav_bb_rel;
} }
}
// Update window-relative bounding box of navigated item // Update window-relative bounding box of navigated item
if (g.NavId == id) if (g.NavId == id)

Loading…
Cancel
Save