summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-09 13:39:45 +0200
committerGitHub <noreply@github.com>2022-05-09 13:39:45 +0200
commita7c69bd95a61fc393033e9b4e000d16ba471bde1 (patch)
treeb85703d7e5666c0a163accb39729cd264276ec06
parent943b50995292d98d9bc2e45ff04eaf0a716cea28 (diff)
parent96cd2d9f521386a65a0ef0cefce9fbb9cc45406f (diff)
Merge pull request #60895 from timothyqiu/tree-button-icon
-rw-r--r--scene/gui/tree.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 89807dbe95..0ca9a66e08 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1754,19 +1754,16 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
for (int j = p_item->cells[i].buttons.size() - 1; j >= 0; j--) {
Ref<Texture2D> b = p_item->cells[i].buttons[j].texture;
Size2 s = b->get_size() + cache.button_pressed->get_minimum_size();
- if (s.height < label_h) {
- s.height = label_h;
- }
Point2i o = Point2i(ofs + w - s.width, p_pos.y) - cache.offset + p_draw_ofs;
if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item == p_item && cache.click_column == i && cache.click_index == j && !p_item->cells[i].buttons[j].disabled) {
- //being pressed
+ // Being pressed.
Point2 od = o;
if (rtl) {
od.x = get_size().width - od.x - s.x;
}
- cache.button_pressed->draw(get_canvas_item(), Rect2(od, s));
+ cache.button_pressed->draw(get_canvas_item(), Rect2(od.x, od.y, s.width, MAX(s.height, label_h)));
}
o.y += (label_h - s.height) / 2;