]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Actions bar dynamic resizing (#31759)
authorgodisdeadLOL <169250097+godisdeadLOL@users.noreply.github.com>
Mon, 2 Sep 2024 19:12:11 +0000 (22:12 +0300)
committerGitHub <noreply@github.com>
Mon, 2 Sep 2024 19:12:11 +0000 (15:12 -0400)
* action bar dynamic resizing

* action bar dynamic resizing for separated style

* decreased indent for separated style

---------

Co-authored-by: YourUsername <you@example.com>
Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs
Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs

index 0fb1b7d507f8c5142910d306ac85a32517e60816..12f8422aeb28b6a46f2336e0cbfff71200a59a22 100644 (file)
@@ -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 _)
index 45a29e03f1dda73ab115c067961a75c6960c16a5..e04d377d321586751020b768fb87fe82c0b277a3 100644 (file)
@@ -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<ChatBox>()!;