MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / TreeNodeDrawLineToChildNode

Method TreeNodeDrawLineToChildNode

3rdparty/imgui/src/imgui_widgets.cpp:7154–7181  ·  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

7152// Draw horizontal line from our parent node
7153// This is only called for visible child nodes so we are not too fussy anymore about performances
7154void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos)
7155{
7156 ImGuiContext& g = *GImGui;
7157 ImGuiWindow* window = g.CurrentWindow;
7158 if (window->DC.TreeDepth == 0 || (window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))) == 0)
7159 return;
7160
7161 ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
7162 float x1 = ImTrunc(parent_data->DrawLinesX1);
7163 float x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x);
7164 float y = ImTrunc(target_pos.y);
7165 float rounding = (g.Style.TreeLinesRounding > 0.0f) ? ImMin(x2 - x1, g.Style.TreeLinesRounding) : 0.0f;
7166 parent_data->DrawLinesToNodesY2 = ImMax(parent_data->DrawLinesToNodesY2, y - rounding);
7167 if (x1 >= x2)
7168 return;
7169 if (rounding > 0.0f)
7170 {
7171 x1 += 0.5f + rounding;
7172 window->DrawList->PathArcToFast(ImVec2(x1, y - rounding), rounding, 6, 3);
7173 if (x1 < x2)
7174 window->DrawList->PathLineTo(ImVec2(x2, y));
7175 window->DrawList->PathStroke(GetColorU32(ImGuiCol_TreeLines), g.Style.TreeLinesSize);
7176 }
7177 else
7178 {
7179 window->DrawList->AddLineH(x1, x2, y, GetColorU32(ImGuiCol_TreeLines), g.Style.TreeLinesSize);
7180 }
7181}
7182
7183// Draw vertical line of the hierarchy
7184void ImGui::TreeNodeDrawLineToTreePop(const ImGuiTreeNodeStackData* data)

Callers

nothing calls this directly

Calls 8

ImTruncFunction · 0.85
ImMinFunction · 0.85
ImMaxFunction · 0.85
PathArcToFastMethod · 0.80
PathLineToMethod · 0.80
PathStrokeMethod · 0.80
AddLineHMethod · 0.80
ImVec2Function · 0.50

Tested by

no test coverage detected