From 837df886f3f91d6f9a80cbb73d202fc4c1ab481f Mon Sep 17 00:00:00 2001 From: Septian Date: Mon, 10 Jul 2023 20:00:18 +0700 Subject: [PATCH] Fix dragged nodes have icon size --- editor/gui/scene_tree_editor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index 41f81a3f600..fbe167814d9 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -1208,8 +1208,11 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from if (i < list_max) { HBoxContainer *hb = memnew(HBoxContainer); TextureRect *tf = memnew(TextureRect); + int icon_size = get_theme_constant(SNAME("class_icon_size"), SNAME("Editor")); + tf->set_custom_minimum_size(Size2(icon_size, icon_size)); + tf->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); + tf->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE); tf->set_texture(icons[i]); - tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); hb->add_child(tf); Label *label = memnew(Label(selected_nodes[i]->get_name())); hb->add_child(label);