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 | |
parent | de0d30655859a46eaf711e209fe20d9ca60a60f2 (diff) |
Fixes icons in itemlist not working
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index b5e2a8675f..635813f4b2 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -1729,6 +1729,7 @@ void TileMapEditor::_rotate(int steps) { transpose = mirrored_rotation_matrix[new_id][0]; flip_h = mirrored_rotation_matrix[new_id][1]; flip_v = mirrored_rotation_matrix[new_id][2]; + break; } } } else { 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()) { |