Docking: Amend b16f738 fixed dimming of docked window + removed thin highlight around windows (never worked on docked window, not viewports friendly, hard to move to EndFrame) (#2700, #2539, #2522)

This commit is contained in:
ocornut 2021-12-03 16:10:24 +01:00
parent b16f738d04
commit c122c0ef89

View File

@ -6730,16 +6730,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if (dim_bg_for_modal || dim_bg_for_window_list) if (dim_bg_for_modal || dim_bg_for_window_list)
{ {
const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio); const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);
if (window->DockIsActive || (flags & ImGuiWindowFlags_DockNodeHost))
window->DrawList->ChannelsSetCurrent(0);
window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col); window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col);
} if (window->DockIsActive || (flags & ImGuiWindowFlags_DockNodeHost))
window->DrawList->ChannelsSetCurrent(1);
// Draw navigation selection/windowing rectangle background
if (dim_bg_for_window_list && window == g.NavWindowingTargetAnim)
{
ImRect bb = window->Rect();
bb.Expand(g.FontSize);
if (!bb.Contains(viewport_rect)) // Avoid drawing if the window covers all the viewport anyway
window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding);
} }
// Child windows can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call (since 1.71) // Child windows can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call (since 1.71)