Skip to content

Commit 3490046

Browse files
committed
Nav: Disabled clipping g.NavId and fixed interactions with ImGuiListClipper. (ocornut#787)
1 parent fd56de1 commit 3490046

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Other Changes:
4949
- Selectable: Allow using ImGuiSelectableFlags_SpanAllColumns in other columns than first. (#125)
5050
- TreeNode: Made clicking on arrow with _OpenOnArrow toggle the open state on the Mouse Down
5151
event rather than the Mouse Down+Up sequence (this is rather standard behavior).
52+
- Nav: Fixed interactions with ImGuiListClipper, so e.g. Home/End result would not clip the
53+
landing item on the landing frame. (#787)
54+
- Nav: Fixed currently focused item from ever being clipped by ItemAdd(). (#787)
5255
- Scrolling: Fixed scrolling centering API leading to non-integer scrolling values and initial
5356
cursor position. This would often get fixed after the fix item submission, but using the
5457
ImGuiListClipper as the first thing after Begin() could largely break size calculations. (#3073)

imgui.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,6 +2227,8 @@ void ImGui::CalcListClipping(int items_count, float items_height, int* out_items
22272227
ImRect unclipped_rect = window->ClipRect;
22282228
if (g.NavMoveRequest)
22292229
unclipped_rect.Add(g.NavScoringRect);
2230+
if (g.NavJustMovedToId && window->NavLastIds[0] == g.NavJustMovedToId)
2231+
unclipped_rect.Add(ImRect(window->Pos + window->NavRectRel[0].Min, window->Pos + window->NavRectRel[0].Max));
22302232

22312233
const ImVec2 pos = window->DC.CursorPos;
22322234
int start = (int)((unclipped_rect.Min.y - pos.y) / items_height);
@@ -3142,7 +3144,7 @@ bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged
31423144
ImGuiContext& g = *GImGui;
31433145
ImGuiWindow* window = g.CurrentWindow;
31443146
if (!bb.Overlaps(window->ClipRect))
3145-
if (id == 0 || id != g.ActiveId)
3147+
if (id == 0 || (id != g.ActiveId && id != g.NavId))
31463148
if (clip_even_when_logged || !g.LogEnabled)
31473149
return true;
31483150
return false;

0 commit comments

Comments
 (0)