From 0ec448d21d4d4caf1cc5bd275cd0e9bd0688bc8c Mon Sep 17 00:00:00 2001 From: groud Date: Wed, 7 Nov 2018 18:29:24 +0100 Subject: Fixes icons in itemlist not working --- scene/gui/item_list.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scene') diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index cb37fa396d..d082c88995 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -456,6 +456,9 @@ Size2 ItemList::Item::get_icon_size() const { return Size2(); Size2 size_result = Size2(icon_region.size).abs(); + if (icon_region.size.x == 0 || icon_region.size.y == 0) + size_result = icon->get_size(); + if (icon_transposed) { Size2 size_tmp = size_result; size_result.x = size_tmp.y; @@ -1098,7 +1101,8 @@ void ItemList::_notification(int p_what) { draw_rect.size.y = size_tmp.x; } - draw_texture_rect_region(items[i].icon, draw_rect, items[i].icon_region, modulate, items[i].icon_transposed); + Rect2 region = (items[i].icon_region.size.x == 0 || items[i].icon_region.size.y == 0) ? Rect2(Vector2(), items[i].icon->get_size()) : Rect2(items[i].icon_region); + draw_texture_rect_region(items[i].icon, draw_rect, region, modulate, items[i].icon_transposed); } if (items[i].tag_icon.is_valid()) { -- cgit v1.2.3