diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index f91e97028356..f8a82187b9d5 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -962,6 +962,9 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { files->set_max_text_lines(2); files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + const int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); + files->set_fixed_tag_icon_size(Size2(icon_size, icon_size)); + if (thumbnail_size < 64) { folder_thumbnail = get_editor_theme_icon(SNAME("FolderMediumThumb")); file_thumbnail = get_editor_theme_icon(SNAME("FileMediumThumb")); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index cfb46aebc894..40c694184c08 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -638,6 +638,16 @@ Size2 ItemList::Item::get_icon_size() const { return size_result; } +void ItemList::set_fixed_tag_icon_size(const Size2i &p_size) { + if (fixed_tag_icon_size == p_size) { + return; + } + + fixed_tag_icon_size = p_size; + queue_redraw(); + shape_changed = true; +} + void ItemList::gui_input(const Ref &p_event) { ERR_FAIL_COND(p_event.is_null()); @@ -1225,13 +1235,21 @@ void ItemList::_notification(int p_what) { } if (items[i].tag_icon.is_valid()) { + Size2 tag_icon_size; + if (fixed_tag_icon_size.x > 0 && fixed_tag_icon_size.y > 0) { + tag_icon_size = fixed_tag_icon_size; + } else { + tag_icon_size = items[i].tag_icon->get_size(); + } + Point2 draw_pos = items[i].rect_cache.position; draw_pos.x += theme_cache.h_separation / 2; draw_pos.y += theme_cache.v_separation / 2; if (rtl) { - draw_pos.x = size.width - draw_pos.x - items[i].tag_icon->get_width(); + draw_pos.x = size.width - draw_pos.x - tag_icon_size.x; } - draw_texture(items[i].tag_icon, draw_pos + base_ofs); + + draw_texture_rect(items[i].tag_icon, Rect2(draw_pos + base_ofs, tag_icon_size)); } if (!items[i].text.is_empty()) { diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 9a57b9d8fe49..a20688b3d016 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -120,6 +120,7 @@ private: Size2 fixed_icon_size; Size2 max_item_size_cache; + Size2 fixed_tag_icon_size; int defer_select_single = -1; bool allow_rmb_select = false; @@ -261,6 +262,8 @@ public: void set_fixed_icon_size(const Size2i &p_size); Size2i get_fixed_icon_size() const; + void set_fixed_tag_icon_size(const Size2i &p_size); + void set_allow_rmb_select(bool p_allow); bool get_allow_rmb_select() const;