From 64b4598baa9c404ba0c3b83c1c2524b6d2dcbcdd Mon Sep 17 00:00:00 2001 From: Anish Mishra Date: Thu, 1 May 2025 18:09:19 +0530 Subject: [PATCH] Improve Android editor layout --- editor/editor_node.cpp | 14 ++++++++++---- editor/editor_node.h | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 558e8856a3a..ffe6a3e574e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -7426,21 +7426,27 @@ EditorNode::EditorNode() { main_vbox = memnew(VBoxContainer); #ifdef ANDROID_ENABLED - main_hbox = memnew(HBoxContainer); - main_hbox->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); + base_vbox = memnew(VBoxContainer); + base_vbox->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT, Control::PRESET_MODE_MINSIZE, theme->get_constant(SNAME("window_border_margin"), EditorStringName(Editor))); + title_bar = memnew(EditorTitleBar); + base_vbox->add_child(title_bar); + + main_hbox = memnew(HBoxContainer); main_hbox->add_child(main_vbox); main_vbox->set_h_size_flags(Control::SIZE_EXPAND_FILL); + main_hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL); + base_vbox->add_child(main_hbox); _touch_actions_panel_mode_changed(); - gui_base->add_child(main_hbox); + gui_base->add_child(base_vbox); #else gui_base->add_child(main_vbox); -#endif title_bar = memnew(EditorTitleBar); main_vbox->add_child(title_bar); +#endif left_l_hsplit = memnew(DockSplitContainer); left_l_hsplit->set_name("DockHSplitLeftL"); diff --git a/editor/editor_node.h b/editor/editor_node.h index a120d9b95da..4733194bfe5 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -282,7 +282,8 @@ private: OptionButton *renderer = nullptr; #ifdef ANDROID_ENABLED - HBoxContainer *main_hbox = nullptr; // Only created on Android for TouchActionsPanel. + VBoxContainer *base_vbox = nullptr; // It only contains the title_bar and main_hbox. + HBoxContainer *main_hbox = nullptr; // It only contains the touch_actions_panel and main_vbox. TouchActionsPanel *touch_actions_panel = nullptr; void _touch_actions_panel_mode_changed(); #endif