diff options
author | groud <gilles.roudiere@gmail.com> | 2018-11-07 18:29:24 +0100 |
---|---|---|
committer | groud <gilles.roudiere@gmail.com> | 2018-11-07 18:29:24 +0100 |
commit | 0ec448d21d4d4caf1cc5bd275cd0e9bd0688bc8c (patch) | |
tree | 12a0672f066369fafe8b5fbd1fb658cbbd46932c /scene | |
parent | de0d30655859a46eaf711e209fe20d9ca60a60f2 (diff) |
Fixes icons in itemlist not working
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/item_list.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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()) { |