Docking: Fixed splitting/docking into a node that has buttons amended into tab bar. Windows were not moved correctly. (#5515)

This commit is contained in:
ocornut 2022-08-03 16:11:39 +02:00
parent e21f462f6f
commit 0abe7d1cc5

View File

@ -14738,10 +14738,14 @@ static void ImGui::DockNodeMoveWindows(ImGuiDockNode* dst_node, ImGuiDockNode* s
src_node->TabBar = NULL;
}
for (int n = 0; n < src_node->Windows.Size; n++)
for (int n_from_node = 0, n_from_tab_bar = 0; n_from_node < src_node->Windows.Size; n_from_node++, n_from_tab_bar++)
{
// DockNode's TabBar may have non-window Tabs manually appended by user
if (ImGuiWindow* window = src_tab_bar ? src_tab_bar->Tabs[n].Window : src_node->Windows[n])
while (src_tab_bar && src_tab_bar->Tabs[n_from_tab_bar].Window == NULL)
n_from_tab_bar++;
// Using TabBar order (FIXME: Why? Clarify + add tests for it)
if (ImGuiWindow* window = src_tab_bar ? src_tab_bar->Tabs[n_from_tab_bar].Window : src_node->Windows[n_from_node])
{
window->DockNode = NULL;
window->DockIsActive = false;