diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cpp index 28fe897b7d..b1aced06a0 100644 --- a/editor/run/game_view_plugin.cpp +++ b/editor/run/game_view_plugin.cpp @@ -52,6 +52,7 @@ #include "scene/gui/flow_container.h" #include "scene/gui/label.h" #include "scene/gui/menu_button.h" +#include "scene/gui/panel.h" #include "scene/gui/separator.h" void GameViewDebugger::_session_started(Ref p_session) { @@ -1423,13 +1424,10 @@ GameView::GameView(Ref p_debugger, EmbeddedProcessBase *p_embe game_size_label->set_h_size_flags(SIZE_EXPAND_FILL); game_size_label->set_horizontal_alignment(HorizontalAlignment::HORIZONTAL_ALIGNMENT_RIGHT); - panel = memnew(PanelContainer); + panel = memnew(Panel); add_child(panel); panel->set_theme_type_variation("GamePanel"); panel->set_v_size_flags(SIZE_EXPAND_FILL); -#ifdef MACOS_ENABLED - panel->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); -#endif panel->add_child(embedded_process); embedded_process->set_anchors_and_offsets_preset(PRESET_FULL_RECT); @@ -1439,8 +1437,17 @@ GameView::GameView(Ref p_debugger, EmbeddedProcessBase *p_embe embedded_process->connect("embedded_process_focused", callable_mp(this, &GameView::_embedded_process_focused)); embedded_process->set_custom_minimum_size(Size2i(100, 100)); + MarginContainer *state_container = memnew(MarginContainer); + state_container->add_theme_constant_override("margin_left", 8 * EDSCALE); + state_container->add_theme_constant_override("margin_right", 8 * EDSCALE); + state_container->set_anchors_and_offsets_preset(PRESET_FULL_RECT); +#ifdef MACOS_ENABLED + state_container->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); +#endif + + panel->add_child(state_container); state_label = memnew(Label()); - panel->add_child(state_label); + state_container->add_child(state_label); state_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); state_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); state_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD); diff --git a/editor/run/game_view_plugin.h b/editor/run/game_view_plugin.h index c4e31e388d..90fc34932e 100644 --- a/editor/run/game_view_plugin.h +++ b/editor/run/game_view_plugin.h @@ -181,7 +181,7 @@ class GameView : public VBoxContainer { HBoxContainer *embedding_hb = nullptr; MenuButton *embed_options_menu = nullptr; Label *game_size_label = nullptr; - PanelContainer *panel = nullptr; + Panel *panel = nullptr; EmbeddedProcessBase *embedded_process = nullptr; Label *state_label = nullptr; diff --git a/editor/themes/theme_classic.cpp b/editor/themes/theme_classic.cpp index 59e201e56e..d68cf1dc74 100644 --- a/editor/themes/theme_classic.cpp +++ b/editor/themes/theme_classic.cpp @@ -1645,11 +1645,9 @@ void ThemeClassic::populate_editor_styles(const Ref &p_theme, Edito p_theme->set_stylebox("ScriptEditor", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); // Game view. - p_theme->set_type_variation("GamePanel", "PanelContainer"); + p_theme->set_type_variation("GamePanel", "Panel"); Ref game_panel = p_theme->get_stylebox(SceneStringName(panel), SNAME("Panel"))->duplicate(); game_panel->set_corner_radius_all(0); - game_panel->set_content_margin_all(0); - game_panel->set_draw_center(true); p_theme->set_stylebox(SceneStringName(panel), "GamePanel", game_panel); // Main menu. diff --git a/editor/themes/theme_modern.cpp b/editor/themes/theme_modern.cpp index d6226ffee5..5e5afc5029 100644 --- a/editor/themes/theme_modern.cpp +++ b/editor/themes/theme_modern.cpp @@ -1672,11 +1672,9 @@ void ThemeModern::populate_editor_styles(const Ref &p_theme, Editor p_theme->set_stylebox("ScriptEditor", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); // Game view. - p_theme->set_type_variation("GamePanel", "PanelContainer"); + p_theme->set_type_variation("GamePanel", "Panel"); Ref game_panel = p_theme->get_stylebox(SceneStringName(panel), SNAME("Panel"))->duplicate(); game_panel->set_corner_radius_all(0); - game_panel->set_content_margin_all(0); - game_panel->set_draw_center(true); p_theme->set_stylebox(SceneStringName(panel), "GamePanel", game_panel); // Main menu.