Nav: Highlight clipped within host window then extruded out. (#787)

docking
omar 7 years ago
parent cb4e6c8212
commit 6ea90af6b7

@ -2155,14 +2155,16 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id)
return; return;
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
ImRect display_rect = bb;
display_rect.ClipWith(window->ClipRect);
const float THICKNESS = 2.0f; const float THICKNESS = 2.0f;
const float DISTANCE = 3.0f + THICKNESS * 0.5f; const float DISTANCE = 3.0f + THICKNESS * 0.5f;
ImRect display_rect(bb.Min - ImVec2(DISTANCE,DISTANCE), bb.Max + ImVec2(DISTANCE,DISTANCE)); display_rect.Expand(ImVec2(DISTANCE,DISTANCE));
if (!window->ClipRect.Contains(display_rect)) bool fully_visible = window->ClipRect.Contains(display_rect);
if (!fully_visible)
window->DrawList->PushClipRect(display_rect.Min, display_rect.Max); 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(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 (!fully_visible)
if (!window->ClipRect.Contains(display_rect))
window->DrawList->PopClipRect(); window->DrawList->PopClipRect();
} }

Loading…
Cancel
Save