Viewport: Modal display their darkneing/whitening layer over all viewports. (#1542)

This commit is contained in:
omar 2018-03-07 11:36:37 +01:00
parent 25fd9d6132
commit 21ff03978a

View File

@ -6515,9 +6515,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
else else
PushClipRect(viewport_rect.Min, viewport_rect.Max, true); PushClipRect(viewport_rect.Min, viewport_rect.Max, true);
// Draw modal window background (darkens what is behind them) // Draw modal window background (darkens what is behind them, all viewports)
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow()) if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow() && window->HiddenFrames <= 0)
{
window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio)); window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
for (int viewport_n = 0; viewport_n < g.Viewports.Size; viewport_n++)
if (g.Viewports[viewport_n] != window->Viewport)
g.OverlayDrawList.AddRectFilled(g.Viewports[viewport_n]->Pos, g.Viewports[viewport_n]->Pos + g.Viewports[viewport_n]->Size, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
}
// Draw navigation selection/windowing rectangle background // Draw navigation selection/windowing rectangle background
if (g.NavWindowingTarget == window) if (g.NavWindowingTarget == window)