From 5e9e95c34c84f4300a109f07b54de6e314ed014b Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 27 Mar 2023 16:13:17 +0800 Subject: Make Add Scene button the same height as scene tabs (cherry picked from commit 8ab11127bcece042800ae5afada3d8a81d10e5be) --- editor/editor_node.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'editor') diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 51d7efb811..0e17c72d90 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -356,12 +356,13 @@ void EditorNode::_update_scene_tabs() { scene_tabs->set_current_tab(editor_data.get_edited_scene()); } + const Size2 add_button_size = Size2(0, scene_tabs->get_size().y); if (scene_tabs->get_offset_buttons_visible()) { // Move the add button to a fixed position. if (scene_tab_add->get_parent() == scene_tabs) { scene_tabs->remove_child(scene_tab_add); scene_tab_add_ph->add_child(scene_tab_add); - scene_tab_add->set_position(Point2()); + scene_tab_add->set_rect(Rect2(Point2(), add_button_size)); } } else { // Move the add button to be after the last tab. @@ -371,16 +372,16 @@ void EditorNode::_update_scene_tabs() { } if (scene_tabs->get_tab_count() == 0) { - scene_tab_add->set_position(Point2()); + scene_tab_add->set_rect(Rect2(Point2(), add_button_size)); return; } Rect2 last_tab = scene_tabs->get_tab_rect(scene_tabs->get_tab_count() - 1); int hsep = scene_tabs->get_theme_constant(SNAME("h_separation")); if (scene_tabs->is_layout_rtl()) { - scene_tab_add->set_position(Point2(last_tab.position.x - scene_tab_add->get_size().x - hsep, last_tab.position.y)); + scene_tab_add->set_rect(Rect2(Point2(last_tab.position.x - scene_tab_add->get_size().x - hsep, last_tab.position.y), add_button_size)); } else { - scene_tab_add->set_position(Point2(last_tab.position.x + last_tab.size.width + hsep, last_tab.position.y)); + scene_tab_add->set_rect(Rect2(Point2(last_tab.position.x + last_tab.size.width + hsep, last_tab.position.y), add_button_size)); } } -- cgit v1.2.3