Nav: improved/clarified behavior when requesting PageUp/PageDown from a focused item which is outside of visible boundaries. (#9079)

This commit is contained in:
ocornut
2025-11-18 18:59:06 +01:00
parent 81e01ddebe
commit 37f9153105
2 changed files with 7 additions and 5 deletions

View File

@@ -99,6 +99,9 @@ Other Changes:
on inner rectangle rather than clipping rectangle, ensuring consistent
(but occasionally less practical) navigation result when a window is
partially out of screen. (#787)
- Improved/clarified behavior when requesting PageUp/PageDown from a
focused item which is outside of visible boundaries: now ends up one
page away from focused item. (#9079)
- Clipper: fixed an issue when using up/down from an item outside of
visible bound and using the clipper. (#9079)
- Fonts:

View File

@@ -13815,11 +13815,6 @@ void ImGui::NavUpdateCreateMoveRequest()
float scoring_page_offset_y = 0.0f;
if (window && g.NavMoveDir == ImGuiDir_None && nav_keyboard_active)
scoring_page_offset_y = NavUpdatePageUpPageDown();
if (scoring_page_offset_y != 0.0f)
{
g.NavScoringNoClipRect = window->InnerRect;
g.NavScoringNoClipRect.TranslateY(scoring_page_offset_y);
}
// [DEBUG] Always send a request when holding Ctrl. Hold Ctrl + Arrow change the direction.
#if IMGUI_DEBUG_NAV_SCORING
@@ -13883,7 +13878,11 @@ void ImGui::NavUpdateCreateMoveRequest()
{
ImRect nav_rect_rel = !window->NavRectRel[g.NavLayer].IsInverted() ? window->NavRectRel[g.NavLayer] : ImRect(0, 0, 0, 0);
scoring_rect = WindowRectRelToAbs(window, nav_rect_rel);
if (scoring_page_offset_y != 0.0f)
g.NavScoringNoClipRect = scoring_rect;
scoring_rect.TranslateY(scoring_page_offset_y);
if (scoring_page_offset_y != 0.0f)
g.NavScoringNoClipRect.Add(scoring_rect);
//GetForegroundDrawList()->AddRectFilled(scoring_rect.Min - ImVec2(1, 1), scoring_rect.Max + ImVec2(1, 1), IM_COL32(255, 100, 0, 80)); // [DEBUG] Pre-bias
if (g.NavMoveSubmitted)
NavBiasScoringRect(scoring_rect, window->RootWindowForNav->NavPreferredScoringPosRel[g.NavLayer], g.NavMoveDir, g.NavMoveFlags);