1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Merge pull request #113776 from YeldhamDev/bottom_panel_rtl_fix

Fix broken state of bottom panel on the right-to-left layout
This commit is contained in:
Rémi Verschelde
2025-12-09 17:17:53 +01:00

View File

@@ -63,10 +63,17 @@ void EditorBottomPanel::_on_tab_changed(int p_idx) {
}
void EditorBottomPanel::_theme_changed() {
// Add margin to make space for the right side buttons.
icon_spacer->set_custom_minimum_size(Vector2(get_theme_constant("class_icon_size", EditorStringName(Editor)), 0));
Ref<StyleBox> bottom_tabbar_style = EditorNode::get_singleton()->get_editor_theme()->get_stylebox("tabbar_background", "BottomPanel")->duplicate();
bottom_tabbar_style->set_content_margin(SIDE_RIGHT, bottom_hbox->get_minimum_size().x + bottom_tabbar_style->get_content_margin(SIDE_LEFT));
int icon_width = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
int margin = bottom_hbox->get_minimum_size().x;
if (get_popup()) {
margin -= icon_width;
}
// Add margin to make space for the right side popup button.
icon_spacer->set_custom_minimum_size(Vector2(icon_width, 0));
Ref<StyleBox> bottom_tabbar_style = get_theme_stylebox(SNAME("tabbar_background"), SNAME("BottomPanel"))->duplicate();
bottom_tabbar_style->set_content_margin(is_layout_rtl() ? SIDE_LEFT : SIDE_RIGHT, margin + bottom_tabbar_style->get_content_margin(is_layout_rtl() ? SIDE_RIGHT : SIDE_LEFT));
add_theme_style_override("tabbar_background", bottom_tabbar_style);
if (get_current_tab() == -1) {
@@ -247,7 +254,6 @@ EditorBottomPanel::EditorBottomPanel() {
bottom_hbox = memnew(HBoxContainer);
bottom_hbox->set_mouse_filter(MOUSE_FILTER_IGNORE);
bottom_hbox->set_anchors_and_offsets_preset(Control::PRESET_RIGHT_WIDE);
bottom_hbox->set_h_grow_direction(Control::GROW_DIRECTION_END);
get_tab_bar()->add_child(bottom_hbox);
icon_spacer = memnew(Control);