Skip to content

Commit 43caca0

Browse files
committed
TreeNode: DrawLines: tweak X2 offset to avoid losing line when ItemSpacing is large. (#2920)
1 parent bcbbfda commit 43caca0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

imgui_widgets.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6823,7 +6823,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
68236823
}
68246824

68256825
if (draw_tree_lines)
6826-
TreeNodeDrawLineToChildNode(ImVec2(text_pos.x - text_offset_x, text_pos.y + g.FontSize * 0.5f));
6826+
TreeNodeDrawLineToChildNode(ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.5f));
68276827

68286828
if (span_all_columns && !span_all_columns_label)
68296829
TablePopBackgroundChannel();
@@ -6858,7 +6858,7 @@ void ImGui::TreeNodeDrawLineToChildNode(const ImVec2& target_pos)
68586858

68596859
ImGuiTreeNodeStackData* parent_data = &g.TreeNodeStack.Data[g.TreeNodeStack.Size - 1];
68606860
float x1 = ImTrunc(parent_data->DrawLinesX1);
6861-
float x2 = ImTrunc(target_pos.x);
6861+
float x2 = ImTrunc(target_pos.x - g.Style.ItemInnerSpacing.x);
68626862
float y = ImTrunc(target_pos.y);
68636863
parent_data->DrawLinesY2 = ImMax(parent_data->DrawLinesY2, y);
68646864
if (x1 < x2)

0 commit comments

Comments
 (0)