mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Nav: reworked PageUp/PageDown to pick same-page top/bottom page based on inner rectangle rather than clipping rectangle.
This commit is contained in:
parent
405c802607
commit
81e01ddebe
2 changed files with 12 additions and 4 deletions
|
|
@ -95,6 +95,10 @@ Other Changes:
|
|||
most typically achieved when resizing programmatically or via a docking layout
|
||||
reacting to a platform window resize). (#3237, #9007) [@anton-kl, @ocornut]
|
||||
- Nav:
|
||||
- Reworked PageUp/PageDown to pick same-page top/bottom page based
|
||||
on inner rectangle rather than clipping rectangle, ensuring consistent
|
||||
(but occasionally less practical) navigation result when a window is
|
||||
partially out of screen. (#787)
|
||||
- Clipper: fixed an issue when using up/down from an item outside of
|
||||
visible bound and using the clipper. (#9079)
|
||||
- Fonts:
|
||||
|
|
|
|||
12
imgui.cpp
12
imgui.cpp
|
|
@ -13207,10 +13207,14 @@ static void ImGui::NavProcessItem()
|
|||
|
||||
// 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, nav_bb))
|
||||
NavApplyItemToResult(&g.NavMoveResultLocalVisible);
|
||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet)
|
||||
{
|
||||
const ImRect& r = window->InnerRect; // window->ClipRect
|
||||
if (r.Overlaps(nav_bb))
|
||||
if (ImClamp(nav_bb.Max.y, r.Min.y, r.Max.y) - ImClamp(nav_bb.Min.y, r.Min.y, r.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO)
|
||||
if (NavScoreItem(&g.NavMoveResultLocalVisible, nav_bb))
|
||||
NavApplyItemToResult(&g.NavMoveResultLocalVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue