diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 9b6b6f1fc48..3faaeae01e1 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2314,14 +2314,6 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 cell_rect.size.x += theme_cache.h_separation; } - if (theme_cache.draw_guides) { - Rect2 r = cell_rect; - if (rtl) { - r.position.x = get_size().width - r.position.x - r.size.x; - } - RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(r.position.x, r.position.y + r.size.height), r.position + r.size, theme_cache.guide_color, 1); - } - if (i == 0 && select_mode == SELECT_ROW) { if (p_item->cells[0].selected || is_row_hovered) { const Rect2 content_rect = _get_content_rect(); @@ -2398,6 +2390,14 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } } + if (theme_cache.draw_guides) { + Rect2 r = cell_rect; + if (rtl) { + r.position.x = get_size().width - r.position.x - r.size.x; + } + RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(r.position.x, r.position.y + r.size.height), r.position + r.size, theme_cache.guide_color, 1); + } + if (p_item->cells[i].custom_bg_color) { Rect2 r = cell_rect; if (i == 0) {