mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 07:36:35 +00:00
Docking: Fixed docking a split node into the empty central node of a dockspace leading to the central node tag being incorrectly carried along. (#2109)
This commit is contained in:
parent
8011197c50
commit
7cc86d4bc9
11
imgui.cpp
11
imgui.cpp
@ -10514,6 +10514,15 @@ void ImGui::DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req)
|
|||||||
DockNodeMoveWindows(visible_node, target_node);
|
DockNodeMoveWindows(visible_node, target_node);
|
||||||
DockSettingsMoveDockReferencesInInactiveWindow(target_node->ID, visible_node->ID);
|
DockSettingsMoveDockReferencesInInactiveWindow(target_node->ID, visible_node->ID);
|
||||||
}
|
}
|
||||||
|
if (target_node->IsCentralNode)
|
||||||
|
{
|
||||||
|
// Central node property needs to be moved to a leaf node, pick the last focused one.
|
||||||
|
ImGuiDockNode* last_focused_node = DockContextFindNodeByID(ctx, payload_node->LastFocusedNodeID);
|
||||||
|
IM_ASSERT(last_focused_node != NULL && DockNodeGetRootNode(last_focused_node) == DockNodeGetRootNode(payload_node));
|
||||||
|
last_focused_node->IsCentralNode = true;
|
||||||
|
target_node->IsCentralNode = false;
|
||||||
|
}
|
||||||
|
|
||||||
IM_ASSERT(target_node->Windows.Size == 0);
|
IM_ASSERT(target_node->Windows.Size == 0);
|
||||||
DockNodeMoveChildNodes(target_node, payload_node);
|
DockNodeMoveChildNodes(target_node, payload_node);
|
||||||
}
|
}
|
||||||
@ -10837,7 +10846,7 @@ static void DockNodeUpdateScanRec(ImGuiDockNode* node, ImGuiDockNodeUpdateScanRe
|
|||||||
if (node->IsCentralNode)
|
if (node->IsCentralNode)
|
||||||
{
|
{
|
||||||
IM_ASSERT(results->CentralNode == NULL); // Should be only one
|
IM_ASSERT(results->CentralNode == NULL); // Should be only one
|
||||||
IM_ASSERT(node->IsLeafNode() && "If you get this assert: your .ini file may have been damaged by an old bug. OR please submit repro of actions leading to this");
|
IM_ASSERT(node->IsLeafNode() && "If you get this assert: please submit .ini file + repro of actions leading to this.");
|
||||||
results->CentralNode = node;
|
results->CentralNode = node;
|
||||||
}
|
}
|
||||||
if (results->CountNodesWithWindows > 1 && results->CentralNode != NULL)
|
if (results->CountNodesWithWindows > 1 && results->CentralNode != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user