Browse Source

Merge pull request #53039 from pycbouh/tree-fix-folding-arrow-with-margin-3.x

[3.x] Correctly calculate position of the folding arrow in `Tree`
Rémi Verschelde 3 years ago
parent
commit
f8b8ef656c
1 changed files with 4 additions and 1 deletions
  1. 4 1
      scene/gui/tree.cpp

+ 4 - 1
scene/gui/tree.cpp

@@ -1404,7 +1404,10 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
 				arrow = cache.arrow;
 			}
 
-			arrow->draw(ci, p_pos + p_draw_ofs + Point2i(0, (label_h - arrow->get_height()) / 2) - cache.offset);
+			Point2 apos = p_pos + Point2i(0, (label_h - arrow->get_height()) / 2) - cache.offset + p_draw_ofs;
+			apos.x += cache.item_margin - arrow->get_width();
+
+			arrow->draw(ci, apos);
 		}
 	}