4242#include " scene/gui/button.h"
4343#include " scene/gui/split_container.h"
4444
45- void EditorBottomPanel::_update_margins () {
46- TabContainer::_update_margins ();
47- get_tab_bar ()->set_offset (SIDE_RIGHT, get_tab_bar ()->get_offset (SIDE_RIGHT) - bottom_hbox->get_size ().x );
48- }
49-
5045void EditorBottomPanel::_notification (int p_what) {
5146 switch (p_what) {
5247 case NOTIFICATION_THEME_CHANGED: {
@@ -60,8 +55,25 @@ void EditorBottomPanel::_on_tab_changed(int p_idx) {
6055 callable_mp (this , &EditorBottomPanel::_repaint).call_deferred ();
6156}
6257
58+ void EditorBottomPanel::_theme_changed () {
59+ Ref<StyleBox> bottom_tabbar_style = get_theme_stylebox (" tabbar_background" , " BottomPanel" )->duplicate ();
60+ bottom_tabbar_style->set_content_margin (SIDE_RIGHT, bottom_hbox->get_minimum_size ().x + bottom_tabbar_style->get_content_margin (SIDE_LEFT));
61+ add_theme_style_override (" tabbar_background" , bottom_tabbar_style);
62+
63+ if (get_current_tab () == -1 ) {
64+ // Hide panel when not showing anything.
65+ remove_theme_style_override (SceneStringName (panel));
66+ } else {
67+ add_theme_style_override (SceneStringName (panel), get_theme_stylebox (SNAME (" BottomPanel" ), EditorStringName (EditorStyles)));
68+ }
69+ }
70+
6371void EditorBottomPanel::_repaint () {
6472 bool panel_collapsed = get_current_tab () == -1 ;
73+ if (panel_collapsed == (get_previous_tab () == -1 )) {
74+ return ;
75+ }
76+
6577 SplitContainer *center_split = Object::cast_to<SplitContainer>(get_parent ());
6678 ERR_FAIL_NULL (center_split);
6779
@@ -74,12 +86,7 @@ void EditorBottomPanel::_repaint() {
7486 EditorNode::get_top_split ()->set_visible (panel_collapsed);
7587 }
7688
77- if (panel_collapsed) {
78- // Hide panel when not showing anything.
79- remove_theme_style_override (SceneStringName (panel));
80- } else {
81- add_theme_style_override (SceneStringName (panel), get_theme_stylebox (SNAME (" BottomPanel" ), EditorStringName (EditorStyles)));
82- }
89+ _theme_changed ();
8390}
8491
8592void EditorBottomPanel::save_layout_to_config (Ref<ConfigFile> p_config_file, const String &p_section) const {
@@ -194,7 +201,6 @@ void EditorBottomPanel::_on_button_visibility_changed(Button *p_button, Control
194201EditorBottomPanel::EditorBottomPanel () {
195202 get_tab_bar ()->connect (SceneStringName (gui_input), callable_mp (EditorDockManager::get_singleton (), &EditorDockManager::_dock_container_gui_input).bind (this ));
196203 get_tab_bar ()->connect (" tab_changed" , callable_mp (this , &EditorBottomPanel::_on_tab_changed));
197- set_custom_minimum_size (Size2 (400 * EDSCALE, 0 ));
198204 set_tabs_position (TabPosition::POSITION_BOTTOM);
199205 set_deselect_enabled (true );
200206
0 commit comments