Nav: Fixed clipping rect of navigation highlight, notably for collapsing arrow (#323)

This commit is contained in:
ocornut 2016-08-15 11:41:56 +02:00
parent 9501cd9991
commit 6c19d7b13c

View File

@ -2080,9 +2080,13 @@ static void RenderNavHighlight(ImU32 id, const ImRect& bb)
if (id != g.NavId || g.NavDisableHighlight) if (id != g.NavId || g.NavDisableHighlight)
return; return;
ImGuiWindow* window = ImGui::GetCurrentWindow(); 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(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->AddRect(g.NavRefRectScreen.Min, g.NavRefRectScreen.Max, IM_COL32(255,0,0,255));
if (!window->ClipRect.Contains(clip_rect))
window->DrawList->PopClipRect(); window->DrawList->PopClipRect();
} }