mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Nav: Fix navigation resuming on first visible item when using gamepad.
In cases where navigation was requested with focused item out of view, clipping of current item rect resulted in an inverted rect, which was completely discarded and ImRect(0,0,0,0) was used as current point from which navigation scoring was calculated. IsInverted() check is completely removed as rect can no longer be inverted. Since rects are not initialized to ImRect(0,0,0,0) - old .Min.x != FLT_MAX check (which was changed in c7835dd189
) is not necessary either.
This commit is contained in:
parent
1e8b9f84da
commit
833eb771f2
@ -45,11 +45,12 @@ Other Changes:
|
||||
It is a rather unusual or useless combination of features but no reason it shouldn't work!
|
||||
- DragFloat, DragScalar: Fixed ImGuiSliderFlags_ClampOnInput not being honored in the special case
|
||||
where v_min == v_max. (#3361)
|
||||
- Nav: Fix navigation resuming on first visible item when using gamepad. [@rokups]
|
||||
- BeginMenuBar: Fixed minor bug where CursorPosMax gets pushed to CursorPos prior to calling BeginMenuBar(),
|
||||
so e.g. calling the function at the end of a window would often add +ItemSpacing.y to scrolling range.
|
||||
- TreeNode, CollapsingHeader: Made clicking on arrow toggle toggle the open state on the Mouse Down event
|
||||
rather than the Mouse Down+Up sequence, even if the _OpenOnArrow flag isn't set. This is standard behavior
|
||||
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
||||
- TreeNode, CollapsingHeader: Made clicking on arrow toggle toggle the open state on the Mouse Down event
|
||||
rather than the Mouse Down+Up sequence, even if the _OpenOnArrow flag isn't set. This is standard behavior
|
||||
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
||||
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
||||
- Tab Bar: Keep tab item close button visible while dragging a tab (independent of hovering state).
|
||||
- Metrics: Various tweaks, listing windows front-to-back, greying inactive items when possible.
|
||||
|
@ -8767,13 +8767,13 @@ static void ImGui::NavUpdate()
|
||||
{
|
||||
float pad = window->CalcFontSize() * 0.5f;
|
||||
window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(), pad), -ImMin(window_rect_rel.GetHeight(), pad))); // Terrible approximation for the intent of starting navigation from first fully visible item
|
||||
window->NavRectRel[g.NavLayer].ClipWith(window_rect_rel);
|
||||
window->NavRectRel[g.NavLayer].ClipWithFull(window_rect_rel);
|
||||
g.NavId = g.NavFocusScopeId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items)
|
||||
ImRect nav_rect_rel = (g.NavWindow && !g.NavWindow->NavRectRel[g.NavLayer].IsInverted()) ? g.NavWindow->NavRectRel[g.NavLayer] : ImRect(0, 0, 0, 0);
|
||||
ImRect nav_rect_rel = g.NavWindow ? g.NavWindow->NavRectRel[g.NavLayer] : ImRect(0, 0, 0, 0);
|
||||
g.NavScoringRect = g.NavWindow ? ImRect(g.NavWindow->Pos + nav_rect_rel.Min, g.NavWindow->Pos + nav_rect_rel.Max) : GetViewportRect();
|
||||
g.NavScoringRect.TranslateY(nav_scoring_rect_offset_y);
|
||||
g.NavScoringRect.Min.x = ImMin(g.NavScoringRect.Min.x + 1.0f, g.NavScoringRect.Max.x);
|
||||
|
Loading…
Reference in New Issue
Block a user