mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 12:27:01 +00:00
Nav: Fixed nav highlight clipping (affected non non-menu items within menubar) (#323)
This commit is contained in:
parent
78b7e2dfb3
commit
fddf9ca10e
12
imgui.cpp
12
imgui.cpp
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user