1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 10:11:00 +01:00

Nav: Fixed nav highlight clipping (affected non non-menu items within menubar) (#323)

This commit is contained in:
ocornut 2016-08-21 15:25:29 +02:00
parent 78b7e2dfb3
commit fddf9ca10e

View File

@ -2084,12 +2084,14 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id)
return;
ImGuiWindow* window = ImGui::GetCurrentWindow();
ImRect clip_rect(window->InnerRect.Min - ImVec2(4,4), window->InnerRect.Max + ImVec2(4,4));
if (!window->ClipRect.Contains(clip_rect))
window->DrawList->PushClipRect(clip_rect.Min, clip_rect.Max);
window->DrawList->AddRect(bb.Min - ImVec2(3,3), bb.Max + ImVec2(3,3), GetColorU32(ImGuiCol_NavHighlight), g.Style.FrameRounding, 0x0F, 2.0f);
const float THICKNESS = 2.0f;
const float DISTANCE = 3.0f + THICKNESS * 0.5f;
ImRect display_rect(bb.Min - ImVec2(DISTANCE,DISTANCE), bb.Max + ImVec2(DISTANCE,DISTANCE));
if (!window->ClipRect.Contains(display_rect))
window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);
window->DrawList->AddRect(display_rect.Min + ImVec2(THICKNESS*0.5f,THICKNESS*0.5f), display_rect.Max - ImVec2(THICKNESS*0.5f,THICKNESS*0.5f), GetColorU32(ImGuiCol_NavHighlight), g.Style.FrameRounding, 0x0F, THICKNESS);
//window->DrawList->AddRect(g.NavRefRectScreen.Min, g.NavRefRectScreen.Max, IM_COL32(255,0,0,255));
if (!window->ClipRect.Contains(clip_rect))
if (!window->ClipRect.Contains(display_rect))
window->DrawList->PopClipRect();
}