Nav: Disabled clipping g.NavId and fixed interactions with ImGuiListClipper. (#787)

docking
omar 5 years ago
parent fd56de1144
commit 3490046c97

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

@ -2227,6 +2227,8 @@ void ImGui::CalcListClipping(int items_count, float items_height, int* out_items
ImRect unclipped_rect = window->ClipRect; ImRect unclipped_rect = window->ClipRect;
if (g.NavMoveRequest) if (g.NavMoveRequest)
unclipped_rect.Add(g.NavScoringRect); unclipped_rect.Add(g.NavScoringRect);
if (g.NavJustMovedToId && window->NavLastIds[0] == g.NavJustMovedToId)
unclipped_rect.Add(ImRect(window->Pos + window->NavRectRel[0].Min, window->Pos + window->NavRectRel[0].Max));
const ImVec2 pos = window->DC.CursorPos; const ImVec2 pos = window->DC.CursorPos;
int start = (int)((unclipped_rect.Min.y - pos.y) / items_height); 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
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow; ImGuiWindow* window = g.CurrentWindow;
if (!bb.Overlaps(window->ClipRect)) if (!bb.Overlaps(window->ClipRect))
if (id == 0 || id != g.ActiveId) if (id == 0 || (id != g.ActiveId && id != g.NavId))
if (clip_even_when_logged || !g.LogEnabled) if (clip_even_when_logged || !g.LogEnabled)
return true; return true;
return false; return false;

Loading…
Cancel
Save