diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2023-03-27 16:13:17 +0800 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-27 18:00:35 +0200 |
commit | 5e9e95c34c84f4300a109f07b54de6e314ed014b (patch) | |
tree | 03f19a8ec9da8b113ea12379fd881588fafca7b4 /editor | |
parent | 50ea0951fe91312488ce3556c89cb9eb38d11264 (diff) |
Make Add Scene button the same height as scene tabs
(cherry picked from commit 8ab11127bcece042800ae5afada3d8a81d10e5be)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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)); } } |