Godot Engine – Multi-platform 2D and 3D game engine
Prevent project title label from going behind main dock tab bar.
ajreckof3fbc8feca09a
diff --git a/editor/gui/editor_title_bar.cpp b/editor/gui/editor_title_bar.cppindex 7da4b9aa491..af632562de1 100644--- a/editor/gui/editor_title_bar.cpp+++ b/editor/gui/editor_title_bar.cpp@@ -150,7 +150,11 @@ void EditorTitleBar::_notification(int p_what) {}if (base && prev && next) {Size2i title_size = get_size();- Size2i c_size = base->get_combined_minimum_size();+ int center = title_size.x / 2;+ int width = MIN(center - prev->get_position().x, next->get_position().x + next->get_size().x - center) * 1.9;+ width = MAX(width, base->get_combined_minimum_size().x);+ base->set_custom_maximum_size(Size2i(width, title_size.y));+ Size2i c_size = base->get_bound_desired_size();int min_offset = prev->get_position().x + prev->get_combined_minimum_size().x;int max_offset = next->get_position().x + next->get_size().x - next->get_combined_minimum_size().x - c_size.x;@@ -160,10 +164,7 @@ void EditorTitleBar::_notification(int p_what) {fit_child_in_rect(prev, Rect2i(prev->get_position().x, 0, offset - prev->get_position().x, title_size.height));fit_child_in_rect(next, Rect2i(offset + c_size.width, 0, next->get_position().x + next->get_size().x - (offset + c_size.width), title_size.height));-- int center = title_size.x / 2;- int width = MIN(center - prev->get_position().x, next->get_position().x + next->get_size().x - center) * 1.9;- fit_child_in_rect(base, Rect2i(center - width / 2, 0, width, title_size.height));+ fit_child_in_rect(base, Rect2i(offset, 0, c_size.width, title_size.height));}} break;}diff --git a/editor/project_manager/project_manager.cpp b/editor/project_manager/project_manager.cppindex 950807d5a8a..efceb9c4033 100644--- a/editor/project_manager/project_manager.cpp+++ b/editor/project_manager/project_manager.cpp@@ -1565,7 +1565,7 @@ ProjectManager::ProjectManager() {HBoxContainer *left_hbox = memnew(HBoxContainer);left_hbox->set_alignment(BoxContainer::ALIGNMENT_BEGIN);- left_hbox->set_h_size_flags(Control::SIZE_EXPAND_FILL);+ left_hbox->set_h_size_flags(Control::SIZE_FILL);left_hbox->set_stretch_ratio(1.0);title_bar->add_child(left_hbox);@@ -1599,6 +1599,7 @@ ProjectManager::ProjectManager() {// Spacer to center main toggles.left_spacer = memnew(Control);left_spacer->set_mouse_filter(Control::MOUSE_FILTER_PASS);+ left_spacer->set_h_size_flags(Control::SIZE_EXPAND_FILL);title_bar->add_child(left_spacer);}@@ -1613,6 +1614,7 @@ ProjectManager::ProjectManager() {// Spacer to center main toggles.right_spacer = memnew(Control);right_spacer->set_mouse_filter(Control::MOUSE_FILTER_PASS);+ right_spacer->set_h_size_flags(Control::SIZE_EXPAND_FILL);title_bar->add_child(right_spacer);}@@ -1620,7 +1622,7 @@ ProjectManager::ProjectManager() {HBoxContainer *right_hbox = memnew(HBoxContainer);right_hbox->set_alignment(BoxContainer::ALIGNMENT_END);- right_hbox->set_h_size_flags(Control::SIZE_EXPAND_FILL);+ right_hbox->set_h_size_flags(Control::SIZE_FILL);right_hbox->set_stretch_ratio(1.0);title_bar->add_child(right_hbox);