From 6c19d7b13c3765b8df555dced1919f806f843759 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 15 Aug 2016 11:41:56 +0200 Subject: [PATCH] Nav: Fixed clipping rect of navigation highlight, notably for collapsing arrow (#323) --- imgui.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index e7a2a76a..252d795e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2080,10 +2080,14 @@ static void RenderNavHighlight(ImU32 id, const ImRect& bb) if (id != g.NavId || g.NavDisableHighlight) return; ImGuiWindow* window = ImGui::GetCurrentWindow(); - window->DrawList->PushClipRect(window->InnerRect.Min - ImVec2(2,2), window->InnerRect.Max + ImVec2(2,2)); + + ImRect clip_rect(window->InnerRect.Min - ImVec2(2,2), window->InnerRect.Max + ImVec2(2,2)); + if (!window->ClipRect.Contains(clip_rect)) + window->DrawList->PushClipRect(clip_rect.Min, clip_rect.Max); window->DrawList->AddRect(bb.Min - ImVec2(2,2), bb.Max + ImVec2(2,2), ImGui::GetColorU32(ImGuiCol_HeaderHovered), g.Style.FrameRounding); //window->DrawList->AddRect(g.NavRefRectScreen.Min, g.NavRefRectScreen.Max, IM_COL32(255,0,0,255)); - window->DrawList->PopClipRect(); + if (!window->ClipRect.Contains(clip_rect)) + window->DrawList->PopClipRect(); } // Declare item bounding box for clipping and interaction.