From a25132ed5dd4ba478ffde3cc87420daac52ed2e3 Mon Sep 17 00:00:00 2001 From: godisdeadLOL <169250097+godisdeadLOL@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:12:11 +0300 Subject: [PATCH] Actions bar dynamic resizing (#31759) * action bar dynamic resizing * action bar dynamic resizing for separated style * decreased indent for separated style --------- Co-authored-by: YourUsername --- .../UserInterface/Screens/DefaultGameScreen.xaml.cs | 10 +++++++++- .../Screens/SeparatedChatGameScreen.xaml.cs | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs b/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs index 0fb1b7d507..12f8422aeb 100644 --- a/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs +++ b/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs @@ -25,7 +25,15 @@ public sealed partial class DefaultGameScreen : InGameScreen Chat.OnResized += ChatOnResized; Chat.OnChatResizeFinish += ChatOnResizeFinish; - Actions.ActionsContainer.Columns = 1; + + MainViewport.OnResized += ResizeActionContainer; + Inventory.OnResized += ResizeActionContainer; + } + + private void ResizeActionContainer() + { + float indent = Inventory.Size.Y + TopBar.Size.Y + 40; + Actions.ActionsContainer.MaxGridHeight = MainViewport.Size.Y - indent; } private void ChatOnResizeFinish(Vector2 _) diff --git a/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs b/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs index 45a29e03f1..e04d377d32 100644 --- a/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs +++ b/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs @@ -26,6 +26,14 @@ public sealed partial class SeparatedChatGameScreen : InGameScreen ScreenContainer.OnSplitResizeFinished += () => OnChatResized?.Invoke(new Vector2(ScreenContainer.SplitFraction, 0)); + + ViewportContainer.OnResized += ResizeActionContainer; + } + + private void ResizeActionContainer() + { + float indent = 20; + Actions.ActionsContainer.MaxGridWidth = ViewportContainer.Size.X - indent; } public override ChatBox ChatBox => GetWidget()!; -- 2.51.2