mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-14 08:49:54 +02:00
Nav, Docking: Fix crash on dimming docked window and DockSpaceOverViewport() with PassthruCentralNode.
(amend1dc3af3
,23ef6c1
,657073a
)
This commit is contained in:
@ -4636,7 +4636,11 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32
|
||||
|
||||
// Draw behind window by moving the draw command at the FRONT of the draw list
|
||||
{
|
||||
// We've already called AddWindowToDrawData() which called DrawList->ChannelsMerge() on DockNodeHost windows,
|
||||
// and draw list have been trimmed already, hence the explicit recreation of a draw command if missing.
|
||||
ImDrawList* draw_list = window->RootWindowDockTree->DrawList;
|
||||
if (draw_list->CmdBuffer.Size == 0)
|
||||
draw_list->AddDrawCmd();
|
||||
draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // Ensure ImDrawCmd are not merged
|
||||
draw_list->AddRectFilled(viewport_rect.Min, viewport_rect.Max, col);
|
||||
ImDrawCmd cmd = draw_list->CmdBuffer.back();
|
||||
@ -4651,7 +4655,6 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32
|
||||
{
|
||||
ImDrawList* draw_list = FindFrontMostVisibleChildWindow(window->RootWindowDockTree)->DrawList;
|
||||
draw_list->PushClipRect(viewport_rect.Min, viewport_rect.Max, false);
|
||||
//if (window->RootWindowDockTree != window->RootWindow)
|
||||
RenderRectFilledWithHole(draw_list, window->RootWindowDockTree->Rect(), window->RootWindow->Rect(), col, 0.0f);// window->RootWindowDockTree->WindowRounding);
|
||||
draw_list->PopClipRect();
|
||||
}
|
||||
@ -4690,6 +4693,8 @@ static void ImGui::RenderDimmedBackgrounds()
|
||||
bb.Expand(distance);
|
||||
if (bb.GetWidth() >= viewport->Size.x && bb.GetHeight() >= viewport->Size.y)
|
||||
bb.Expand(-distance - 1.0f); // If a window fits the entire viewport, adjust its highlight inward
|
||||
if (window->DrawList->CmdBuffer.Size == 0)
|
||||
window->DrawList->AddDrawCmd();
|
||||
window->DrawList->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size);
|
||||
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), window->WindowRounding, 0, 3.0f);
|
||||
window->DrawList->PopClipRect();
|
||||
|
Reference in New Issue
Block a user