Docking: Fixed another issue where the resulting node of a split would sometimes recall the pos/size of previous host window. Spent a whole day adding framework for testing more of docking so hopefully we'll heading toward the magical world of less regressions. (#2109)

This commit is contained in:
omar 2019-04-13 19:19:56 +02:00
parent 712203dbcb
commit 433a7556c7

View File

@ -11838,6 +11838,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
ImGuiWindow* single_window = node->Windows[0]; ImGuiWindow* single_window = node->Windows[0];
node->Pos = single_window->Pos; node->Pos = single_window->Pos;
node->Size = single_window->SizeFull; node->Size = single_window->SizeFull;
node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_Window;
// Transfer focus immediately so when we revert to a regular window it is immediately selected // Transfer focus immediately so when we revert to a regular window it is immediately selected
if (node->HostWindow && g.NavWindow == node->HostWindow) if (node->HostWindow && g.NavWindow == node->HostWindow)
@ -11855,7 +11856,6 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
} }
DockNodeHideHostWindow(node); DockNodeHideHostWindow(node);
node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_Window;
node->WantCloseAll = false; node->WantCloseAll = false;
node->WantCloseTabID = 0; node->WantCloseTabID = 0;
node->HasCloseButton = node->HasCollapseButton = false; node->HasCloseButton = node->HasCollapseButton = false;
@ -12664,6 +12664,7 @@ void ImGui::DockNodeTreeSplit(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
parent_node->ChildNodes[split_inheritor_child_idx]->VisibleWindow = parent_node->VisibleWindow; parent_node->ChildNodes[split_inheritor_child_idx]->VisibleWindow = parent_node->VisibleWindow;
parent_node->SplitAxis = split_axis; parent_node->SplitAxis = split_axis;
parent_node->VisibleWindow = NULL; parent_node->VisibleWindow = NULL;
parent_node->AuthorityForPos = parent_node->AuthorityForSize = ImGuiDataAuthority_DockNode;
float size_avail = (parent_node->Size[split_axis] - IMGUI_DOCK_SPLITTER_SIZE); float size_avail = (parent_node->Size[split_axis] - IMGUI_DOCK_SPLITTER_SIZE);
size_avail = ImMax(size_avail, g.Style.WindowMinSize[split_axis] * 2.0f); size_avail = ImMax(size_avail, g.Style.WindowMinSize[split_axis] * 2.0f);