@@ -6829,17 +6829,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
6829
6829
LogSetNextTextDecoration(">", NULL);
6830
6830
}
6831
6831
6832
- if (draw_tree_lines && (window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))))
6833
- {
6834
- // Draw horizontal line from our parent node
6835
- ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
6836
- float x1 = parent_data->DrawLinesX1 + ImTrunc(g.FontSize * 0.5f + g.Style.FramePadding.x); // GetTreeNodeToLabelSpacing() * 0.5f
6837
- float x2 = text_pos.x - text_offset_x;
6838
- float y = text_pos.y + ImTrunc(g.FontSize * 0.5f);
6839
- parent_data->DrawLinesY2 = ImMax(parent_data->DrawLinesY2, y);
6840
- if (x1 < x2)
6841
- window->DrawList->AddLine(ImVec2(x1, y), ImVec2(x2, y), GetColorU32(ImGuiCol_TreeLines), g.Style.TreeLinesSize);
6842
- }
6832
+ if (draw_tree_lines)
6833
+ TreeNodeDrawLineToChildNode(ImVec2(text_pos.x - text_offset_x, text_pos.y + g.FontSize * 0.5f));
6843
6834
6844
6835
if (span_all_columns && !span_all_columns_label)
6845
6836
TablePopBackgroundChannel();
@@ -6863,6 +6854,23 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
6863
6854
return is_open;
6864
6855
}
6865
6856
6857
+ // Draw horizontal line from our parent node
6858
+ // This is only called for visible child nodes so we are not too fussy anymore about performances
6859
+ void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos)
6860
+ {
6861
+ ImGuiContext& g = *GImGui;
6862
+ ImGuiWindow* window = g.CurrentWindow;
6863
+ if ((window->DC.TreeHasStackDataDepthMask & (1 << (window->DC.TreeDepth - 1))) == 0)
6864
+ return;
6865
+
6866
+ ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
6867
+ float x1 = parent_data->DrawLinesX1 + ImTrunc(g.FontSize * 0.5f + g.Style.FramePadding.x); // GetTreeNodeToLabelSpacing() * 0.5f
6868
+ float y = ImTrunc(target_pos.y);
6869
+ parent_data->DrawLinesY2 = ImMax(parent_data->DrawLinesY2, y);
6870
+ if (x1 < target_pos.x)
6871
+ window->DrawList->AddLine(ImVec2(x1, y), ImVec2(target_pos.x, y), GetColorU32(ImGuiCol_TreeLines), g.Style.TreeLinesSize);
6872
+ }
6873
+
6866
6874
void ImGui::TreePush(const char* str_id)
6867
6875
{
6868
6876
ImGuiWindow* window = GetCurrentWindow();
0 commit comments