Docking: Fixed undocking whole node (from collapse/docking menu button) from losing its size/pos. Made collapose/docking menu id easier to compute for testing.

This commit is contained in:
omar 2019-05-18 18:42:59 +02:00
parent 2e5860b5a0
commit 7e772f6a51

View File

@ -11609,6 +11609,7 @@ void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node)
DockSettingsRenameNodeReferences(node->ID, new_node->ID); DockSettingsRenameNodeReferences(node->ID, new_node->ID);
for (int n = 0; n < new_node->Windows.Size; n++) for (int n = 0; n < new_node->Windows.Size; n++)
UpdateWindowParentAndRootLinks(new_node->Windows[n], new_node->Windows[n]->Flags, NULL); UpdateWindowParentAndRootLinks(new_node->Windows[n], new_node->Windows[n]->Flags, NULL);
new_node->AuthorityForPos = new_node->AuthorityForSize = ImGuiDataAuthority_Window;
new_node->WantMouseMove = true; new_node->WantMouseMove = true;
} }
else else
@ -12348,7 +12349,10 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
host_window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu); host_window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
} }
PushID(node->ID); // Use PushOverrideID() instead of PushID() to use the node id _without_ the host window ID.
// This is to facilitate computing those ID from the outside, and will affect more or less only the ID of the collapse button, popup and tabs,
// as docked windows themselves will override the stack with their own root ID.
PushOverrideID(node->ID);
ImGuiTabBar* tab_bar = node->TabBar; ImGuiTabBar* tab_bar = node->TabBar;
bool tab_bar_is_recreated = (tab_bar == NULL); // Tab bar are automatically destroyed when a node gets hidden bool tab_bar_is_recreated = (tab_bar == NULL); // Tab bar are automatically destroyed when a node gets hidden
if (tab_bar == NULL) if (tab_bar == NULL)
@ -12361,6 +12365,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
node->IsFocused = is_focused; node->IsFocused = is_focused;
// Collapse button changes shape and display a list // Collapse button changes shape and display a list
// FIXME-DOCK: Could we recycle popups id?
if (IsPopupOpen("#TabListMenu")) if (IsPopupOpen("#TabListMenu"))
{ {
if (ImGuiID tab_id = DockNodeUpdateTabListMenu(node, tab_bar)) if (ImGuiID tab_id = DockNodeUpdateTabListMenu(node, tab_bar))