|
|
@ -11524,25 +11524,28 @@ static void ImGui::NavProcessItem() |
|
|
|
|
|
|
|
// Process Move Request (scoring for navigation)
|
|
|
|
// FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy)
|
|
|
|
if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0 && (window->Flags & ImGuiWindowFlags_NoNavInputs) == 0) |
|
|
|
if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0) |
|
|
|
{ |
|
|
|
const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0; |
|
|
|
if (is_tabbing) |
|
|
|
if ((g.NavMoveFlags & ImGuiNavMoveFlags_FocusApi) || (window->Flags & ImGuiWindowFlags_NoNavInputs) != 0) |
|
|
|
{ |
|
|
|
NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags); |
|
|
|
} |
|
|
|
else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) |
|
|
|
{ |
|
|
|
ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; |
|
|
|
if (NavScoreItem(result)) |
|
|
|
NavApplyItemToResult(result); |
|
|
|
|
|
|
|
// Features like PageUp/PageDown need to maintain a separate score for the visible set of items.
|
|
|
|
const float VISIBLE_RATIO = 0.70f; |
|
|
|
if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) |
|
|
|
if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) |
|
|
|
if (NavScoreItem(&g.NavMoveResultLocalVisible)) |
|
|
|
NavApplyItemToResult(&g.NavMoveResultLocalVisible); |
|
|
|
const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0; |
|
|
|
if (is_tabbing) |
|
|
|
{ |
|
|
|
NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags); |
|
|
|
} |
|
|
|
else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) |
|
|
|
{ |
|
|
|
ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; |
|
|
|
if (NavScoreItem(result)) |
|
|
|
NavApplyItemToResult(result); |
|
|
|
|
|
|
|
// Features like PageUp/PageDown need to maintain a separate score for the visible set of items.
|
|
|
|
const float VISIBLE_RATIO = 0.70f; |
|
|
|
if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) |
|
|
|
if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) |
|
|
|
if (NavScoreItem(&g.NavMoveResultLocalVisible)) |
|
|
|
NavApplyItemToResult(&g.NavMoveResultLocalVisible); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|