Skip to content

Commit

Permalink
Nav: Fixed nav highlight clipping (affected non non-menu items within…
Browse files Browse the repository at this point in the history
… menubar) (#323)
  • Loading branch information
ocornut committed Aug 21, 2016
1 parent 78b7e2d commit fddf9ca
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit fddf9ca

Please sign in to comment.