1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-16 03:53:28 +01:00

Docking: Fixed an issue where removing the last window from a dockspace node that is not a central node without remove the node. (#2414, #2109)

This commit is contained in:
omar 2019-03-10 22:19:18 +01:00
parent d77d3416d3
commit ecf7666624
2 changed files with 3 additions and 3 deletions

View File

@ -11432,7 +11432,7 @@ static void ImGui::DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window
}
}
if (node->Windows.Size == 0 && !node->IsCentralNode && window->DockId != node->ID)
if (node->Windows.Size == 0 && !node->IsCentralNode && !node->IsDockSpace() && window->DockId != node->ID)
{
// Automatic dock node delete themselves if they are not holding at least one tab
DockContextRemoveNode(&g, node, true);
@ -11631,7 +11631,7 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
static void ImGui::DockNodeUpdateVisibleFlag(ImGuiDockNode* node)
{
// Update visibility flag
bool is_visible = (node->ParentNode == 0) ? node->IsDockSpace() : node->IsCentralNode;
bool is_visible = (node->ParentNode == NULL) ? node->IsDockSpace() : node->IsCentralNode;
is_visible |= (node->Windows.Size > 0);
is_visible |= (node->ChildNodes[0] && node->ChildNodes[0]->IsVisible);
is_visible |= (node->ChildNodes[1] && node->ChildNodes[1]->IsVisible);

View File

@ -1670,7 +1670,7 @@ namespace ImGui
IMGUI_API void DockBuilderDockWindow(const char* window_name, ImGuiID node_id);
IMGUI_API ImGuiDockNode*DockBuilderGetNode(ImGuiID node_id); // Warning: DO NOT HOLD ON ImGuiDockNode* pointer, will be invalided by any split/merge/remove operation.
inline ImGuiDockNode* DockBuilderGetCentralNode(ImGuiID node_id) { ImGuiDockNode* node = DockBuilderGetNode(node_id); if (!node) return NULL; return DockNodeGetRootNode(node)->CentralNode; }
IMGUI_API ImGuiID DockBuilderAddNode(ImGuiID node_id, ImGuiDockNodeFlags flags = 0);
IMGUI_API ImGuiID DockBuilderAddNode(ImGuiID node_id, ImGuiDockNodeFlags flags = 0); // Use (flags == ImGuiDockNodeFlags_Dockspace) to create a dockspace, otherwise it'll create a floating node.
IMGUI_API void DockBuilderRemoveNode(ImGuiID node_id); // Remove node and all its child, undock all windows
IMGUI_API void DockBuilderRemoveNodeDockedWindows(ImGuiID node_id, bool clear_persistent_docking_references = true);
IMGUI_API void DockBuilderRemoveNodeChildNodes(ImGuiID node_id); // Remove all split/hierarchy. All remaining docked windows will be re-docked to the root.