mirror of
https://github.com/Drezil/imgui.git
synced 2025-04-16 08:04:00 +00:00
Nav: Fixed navigating outside of current scrolling bounds (bug from 0cc20fca831e60b4898cf66e3ac595d8bdebb830) (#323)
+ spaces
This commit is contained in:
parent
efc8858328
commit
f2d1472481
13
imgui.cpp
13
imgui.cpp
@ -1920,7 +1920,18 @@ static bool NavScoreItem(ImRect cand)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImRect& curr = g.NavScoringRectScreen; // Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having lots of items with varied width)
|
const ImRect& curr = g.NavScoringRectScreen; // Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having lots of items with varied width)
|
||||||
window->ClipRect.Clip(cand);
|
|
||||||
|
// We perform scoring on items bounding box clipped by their parent window on the other axis (clipping on our movement axis would give us equal scores for all clipped items)
|
||||||
|
if (g.NavMoveDir == ImGuiNavDir_Left || g.NavMoveDir == ImGuiNavDir_Right)
|
||||||
|
{
|
||||||
|
cand.Min.y = ImClamp(cand.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y);
|
||||||
|
cand.Max.y = ImClamp(cand.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cand.Min.x = ImClamp(cand.Min.x, window->ClipRect.Min.x, window->ClipRect.Max.x);
|
||||||
|
cand.Max.x = ImClamp(cand.Max.x, window->ClipRect.Min.x, window->ClipRect.Max.x);
|
||||||
|
}
|
||||||
|
|
||||||
// Compute distance between boxes
|
// Compute distance between boxes
|
||||||
// FIXME-NAVIGATION: Introducing various biases toward typical imgui uses cases, but we don't have any rigorous proof of their effect now.
|
// FIXME-NAVIGATION: Introducing various biases toward typical imgui uses cases, but we don't have any rigorous proof of their effect now.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user