Docking: Simplify logic of moving tabs between nodes. Amends 0abe7d. (#5515)
The idea is that in the absence of a tab bar, as new one gets created new tabs will be sorted based on window->DockOrder so this may work but we're not 100% sure.
This commit is contained in:
parent
e9f50fb87c
commit
ff1567e240
13
imgui.cpp
13
imgui.cpp
@ -14749,19 +14749,12 @@ static void ImGui::DockNodeMoveWindows(ImGuiDockNode* dst_node, ImGuiDockNode* s
|
||||
src_node->TabBar = NULL;
|
||||
}
|
||||
|
||||
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
|
||||
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])
|
||||
// Tab order is not important here, it is preserved by sorting in DockNodeUpdateTabBar().
|
||||
for (ImGuiWindow* window : src_node->Windows)
|
||||
{
|
||||
window->DockNode = NULL;
|
||||
window->DockIsActive = false;
|
||||
DockNodeAddWindow(dst_node, window, move_tab_bar ? false : true);
|
||||
}
|
||||
DockNodeAddWindow(dst_node, window, !move_tab_bar);
|
||||
}
|
||||
src_node->Windows.clear();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user