MCPcopy Create free account
hub / github.com/XJTU-Graphics/dandelion / TreeNodeDrawLineToChildNode

Method TreeNodeDrawLineToChildNode

deps/imgui/imgui_widgets.cpp:6923–6950  ·  view source on GitHub ↗

Draw horizontal line from our parent node This is only called for visible child nodes so we are not too fussy anymore about performances

Source from the content-addressed store, hash-verified

6921// Draw horizontal line from our parent node
6922// This is only called for visible child nodes so we are not too fussy anymore about performances
6923void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos)
6924{
6925 ImGuiContext& g = *GImGui;
6926 ImGuiWindow* window = g.CurrentWindow;
6927 if (window->DC.TreeDepth == 0 || (window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))) == 0)
6928 return;
6929
6930 ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
6931 float x1 = ImTrunc(parent_data->DrawLinesX1);
6932 float x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x);
6933 float y = ImTrunc(target_pos.y);
6934 float rounding = (g.Style.TreeLinesRounding > 0.0f) ? ImMin(x2 - x1, g.Style.TreeLinesRounding) : 0.0f;
6935 parent_data->DrawLinesToNodesY2 = ImMax(parent_data->DrawLinesToNodesY2, y - rounding);
6936 if (x1 >= x2)
6937 return;
6938 if (rounding > 0.0f)
6939 {
6940 x1 += 0.5f + rounding;
6941 window->DrawList->PathArcToFast(ImVec2(x1, y - rounding), rounding, 6, 3);
6942 if (x1 < x2)
6943 window->DrawList->PathLineTo(ImVec2(x2, y));
6944 window->DrawList->PathStroke(GetColorU32(ImGuiCol_TreeLines), ImDrawFlags_None, g.Style.TreeLinesSize);
6945 }
6946 else
6947 {
6948 window->DrawList->AddLine(ImVec2(x1, y), ImVec2(x2, y), GetColorU32(ImGuiCol_TreeLines), g.Style.TreeLinesSize);
6949 }
6950}
6951
6952// Draw vertical line of the hierarchy
6953void ImGui::TreeNodeDrawLineToTreePop(const ImGuiTreeNodeStackData* data)

Callers

nothing calls this directly

Calls 8

ImTruncFunction · 0.85
ImMinFunction · 0.85
ImMaxFunction · 0.85
ImVec2Function · 0.85
PathArcToFastMethod · 0.80
PathLineToMethod · 0.80
PathStrokeMethod · 0.80
AddLineMethod · 0.80

Tested by

no test coverage detected