From 43caca05c27aebaa8f8fc3064d47042dce6c7f8b Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 9 Apr 2025 17:58:23 +0200 Subject: [PATCH] TreeNode: DrawLines: tweak X2 offset to avoid losing line when ItemSpacing is large. (#2920) --- imgui_widgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index b61817b9c..c1d1f54ba 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6823,7 +6823,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l } if (draw_tree_lines) - TreeNodeDrawLineToChildNode(ImVec2(text_pos.x - text_offset_x, text_pos.y + g.FontSize * 0.5f)); + TreeNodeDrawLineToChildNode(ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.5f)); if (span_all_columns && !span_all_columns_label) TablePopBackgroundChannel(); @@ -6858,7 +6858,7 @@ void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos) ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1]; float x1 = ImTrunc(parent_data->DrawLinesX1); - float x2 = ImTrunc(target_pos.x); + float x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x); float y = ImTrunc(target_pos.y); parent_data->DrawLinesY2 = ImMax(parent_data->DrawLinesY2, y); if (x1 < x2)