MCPcopy Create free account
hub / github.com/cinder/Cinder / TreeNodeDrawLineToChildNode

Method TreeNodeDrawLineToChildNode

src/imgui/imgui_widgets.cpp:7038–7065  ·  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

7036// Draw horizontal line from our parent node
7037// This is only called for visible child nodes so we are not too fussy anymore about performances
7038void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos)
7039{
7040 ImGuiContext& g = *GImGui;
7041 ImGuiWindow* window = g.CurrentWindow;
7042 if (window->DC.TreeDepth == 0 || (window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))) == 0)
7043 return;
7044
7045 ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
7046 float x1 = ImTrunc(parent_data->DrawLinesX1);
7047 float x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x);
7048 float y = ImTrunc(target_pos.y);
7049 float rounding = (g.Style.TreeLinesRounding > 0.0f) ? ImMin(x2 - x1, g.Style.TreeLinesRounding) : 0.0f;
7050 parent_data->DrawLinesToNodesY2 = ImMax(parent_data->DrawLinesToNodesY2, y - rounding);
7051 if (x1 >= x2)
7052 return;
7053 if (rounding > 0.0f)
7054 {
7055 x1 += 0.5f + rounding;
7056 window->DrawList->PathArcToFast(ImVec2(x1, y - rounding), rounding, 6, 3);
7057 if (x1 < x2)
7058 window->DrawList->PathLineTo(ImVec2(x2, y));
7059 window->DrawList->PathStroke(GetColorU32(ImGuiCol_TreeLines), ImDrawFlags_None, g.Style.TreeLinesSize);
7060 }
7061 else
7062 {
7063 window->DrawList->AddLine(ImVec2(x1, y), ImVec2(x2, y), GetColorU32(ImGuiCol_TreeLines), g.Style.TreeLinesSize);
7064 }
7065}
7066
7067// Draw vertical line of the hierarchy
7068void 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