Docking: Further fixes for highlight of nested nodes. (#5702)

Amend fb0b9c71, 8f43487, 9764adc, 24dfebf
Added more regression tests e.g "docking_focus_nodes_nested"
This commit is contained in:
ocornut 2022-10-24 20:25:27 +02:00
parent 5370b46c4e
commit 50c4234aca

View File

@ -15379,8 +15379,17 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
if (node->IsSplitNode())
IM_ASSERT(node->TabBar == NULL);
if (node->IsRootNode())
if (g.NavWindow && g.NavWindow->RootWindow->DockNode && g.NavWindow->RootWindow->ParentWindow == host_window)
node->LastFocusedNodeId = g.NavWindow->RootWindow->DockNode->ID;
if (ImGuiWindow* p_window = g.NavWindow ? g.NavWindow->RootWindow : NULL)
while (p_window != NULL && p_window->DockNode != NULL)
{
ImGuiDockNode* p_node = DockNodeGetRootNode(p_window->DockNode);
if (p_node == node)
{
node->LastFocusedNodeId = p_window->DockNode->ID; // Note: not using root node ID!
break;
}
p_window = p_node->HostWindow ? p_node->HostWindow->RootWindow : NULL;
}
// Register a hit-test hole in the window unless we are currently dragging a window that is compatible with our dockspace
ImGuiDockNode* central_node = node->CentralNode;