(Depth-First, Pre-Order)
| 16949 | |
| 16950 | // (Depth-First, Pre-Order) |
| 16951 | void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node) |
| 16952 | { |
| 16953 | if (node->IsLeafNode()) |
| 16954 | return; |
| 16955 | |
| 16956 | ImGuiContext& g = *GImGui; |
| 16957 | |
| 16958 | ImGuiDockNode* child_0 = node->ChildNodes[0]; |
| 16959 | ImGuiDockNode* child_1 = node->ChildNodes[1]; |
| 16960 | if (child_0->IsVisible && child_1->IsVisible) |
| 16961 | { |
| 16962 | // Bounding box of the splitter cover the space between both nodes (w = Spacing, h = Size[xy^1] for when splitting horizontally) |
| 16963 | const ImGuiAxis axis = (ImGuiAxis)node->SplitAxis; |
| 16964 | IM_ASSERT(axis != ImGuiAxis_None); |
| 16965 | ImRect bb; |
| 16966 | bb.Min = child_0->Pos; |
| 16967 | bb.Max = child_1->Pos; |
| 16968 | bb.Min[axis] += child_0->Size[axis]; |
| 16969 | bb.Max[axis ^ 1] += child_1->Size[axis ^ 1]; |
| 16970 | //if (g.IO.KeyCtrl) GetForegroundDrawList(g.CurrentWindow->Viewport)->AddRect(bb.Min, bb.Max, IM_COL32(255,0,255,255)); |
| 16971 | |
| 16972 | const ImGuiDockNodeFlags merged_flags = child_0->MergedFlags | child_1->MergedFlags; // Merged flags for BOTH childs |
| 16973 | const ImGuiDockNodeFlags no_resize_axis_flag = (axis == ImGuiAxis_X) ? ImGuiDockNodeFlags_NoResizeX : ImGuiDockNodeFlags_NoResizeY; |
| 16974 | if ((merged_flags & ImGuiDockNodeFlags_NoResize) || (merged_flags & no_resize_axis_flag)) |
| 16975 | { |
| 16976 | ImGuiWindow* window = g.CurrentWindow; |
| 16977 | window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator), g.Style.FrameRounding); |
| 16978 | } |
| 16979 | else |
| 16980 | { |
| 16981 | //bb.Min[axis] += 1; // Display a little inward so highlight doesn't connect with nearby tabs on the neighbor node. |
| 16982 | //bb.Max[axis] -= 1; |
| 16983 | PushID(node->ID); |
| 16984 | |
| 16985 | // Find resizing limits by gathering list of nodes that are touching the splitter line. |
| 16986 | ImVector<ImGuiDockNode*> touching_nodes[2]; |
| 16987 | float min_size = g.Style.WindowMinSize[axis]; |
| 16988 | float resize_limits[2]; |
| 16989 | resize_limits[0] = node->ChildNodes[0]->Pos[axis] + min_size; |
| 16990 | resize_limits[1] = node->ChildNodes[1]->Pos[axis] + node->ChildNodes[1]->Size[axis] - min_size; |
| 16991 | |
| 16992 | ImGuiID splitter_id = GetID("##Splitter"); |
| 16993 | if (g.ActiveId == splitter_id) // Only process when splitter is active |
| 16994 | { |
| 16995 | DockNodeTreeUpdateSplitterFindTouchingNode(child_0, axis, 1, &touching_nodes[0]); |
| 16996 | DockNodeTreeUpdateSplitterFindTouchingNode(child_1, axis, 0, &touching_nodes[1]); |
| 16997 | for (int touching_node_n = 0; touching_node_n < touching_nodes[0].Size; touching_node_n++) |
| 16998 | resize_limits[0] = ImMax(resize_limits[0], touching_nodes[0][touching_node_n]->Rect().Min[axis] + min_size); |
| 16999 | for (int touching_node_n = 0; touching_node_n < touching_nodes[1].Size; touching_node_n++) |
| 17000 | resize_limits[1] = ImMin(resize_limits[1], touching_nodes[1][touching_node_n]->Rect().Max[axis] - min_size); |
| 17001 | |
| 17002 | // [DEBUG] Render touching nodes & limits |
| 17003 | /* |
| 17004 | ImDrawList* draw_list = node->HostWindow ? GetForegroundDrawList(node->HostWindow) : GetForegroundDrawList(GetMainViewport()); |
| 17005 | for (int n = 0; n < 2; n++) |
| 17006 | { |
| 17007 | for (int touching_node_n = 0; touching_node_n < touching_nodes[n].Size; touching_node_n++) |
| 17008 | draw_list->AddRect(touching_nodes[n][touching_node_n]->Pos, touching_nodes[n][touching_node_n]->Pos + touching_nodes[n][touching_node_n]->Size, IM_COL32(0, 255, 0, 255)); |
nothing calls this directly
no test coverage detected