-
-
Notifications
You must be signed in to change notification settings - Fork 23.8k
Fix center buttons offset #113612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix center buttons offset #113612
Conversation
bruvzg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working fine. Tested on Windows and macOS (with global menu).
There are few extra lines that can be removed (called if menu style is changed in runtime):
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index cc070096c2..dc918500fc 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -7778,13 +7778,6 @@ void EditorNode::_update_main_menu_type() {
}
memdelete_notnull(main_menu_bar);
main_menu_bar = nullptr;
-
- if (project_run_bar != nullptr) {
- // Adjust spacers to center 2D / 3D / Script buttons.
- int max_w = MAX(project_run_bar->get_minimum_size().x + right_menu_hb->get_minimum_size().x, main_menu_button->get_minimum_size().x);
- left_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - main_menu_button->get_minimum_size().x), 0));
- right_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - project_run_bar->get_minimum_size().x - right_menu_hb->get_minimum_size().x), 0));
- }
} else {
main_menu_bar = memnew(MenuBar);
main_menu_bar->set_mouse_filter(Control::MOUSE_FILTER_STOP);
@@ -7815,13 +7808,6 @@ void EditorNode::_update_main_menu_type() {
memdelete_notnull(main_menu_button);
menu_btn_spacer = nullptr;
main_menu_button = nullptr;
-
- if (project_run_bar != nullptr) {
- // Adjust spacers to center 2D / 3D / Script buttons.
- int max_w = MAX(project_run_bar->get_minimum_size().x + right_menu_hb->get_minimum_size().x, main_menu_bar->get_minimum_size().x);
- left_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - main_menu_bar->get_minimum_size().x), 0));
- right_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - project_run_bar->get_minimum_size().x - right_menu_hb->get_minimum_size().x), 0));
- }
}
}Remove set spacers
ebcb06e to
75ba00b
Compare
Done. And I undid the code I modified. Your code in |
Fix #113401.

Move the calculation in the update function.Remove
set_custom_minimum_sizes.After: