Nav: Fixed SetItemDefaultFocus() from not scrolling when item is partially visible. (#2814, #2812)

This commit is contained in:
domgho
2023-03-10 19:12:04 +01:00
committed by ocornut
parent bb224c8aa1
commit 6ca1556d02
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -7505,7 +7505,7 @@ void ImGui::SetItemDefaultFocus()
NavUpdateAnyRequestFlag();
// Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll)
if (!IsItemVisible())
if (!window->ClipRect.Contains(g.LastItemData.Rect))
ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None);
}