]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix separated game screen bumping (#33046)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Tue, 29 Oct 2024 05:07:57 +0000 (16:07 +1100)
committerGitHub <noreply@github.com>
Tue, 29 Oct 2024 05:07:57 +0000 (16:07 +1100)
I don't really understand why RecordedSplitContainer exists but removing it looks identical and fixes the panel bumping occasionally.

Content.Client/Mapping/MappingScreen.xaml
Content.Client/Mapping/MappingScreen.xaml.cs
Content.Client/UserInterface/Controls/RecordedSplitContainer.cs [deleted file]
Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml
Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs

index 9cc3e734f0e9ee7916cacc206557900e5cce3d2e..bad492e7e41ffaf7b67e164eb0af92fb5fc26fe9 100644 (file)
@@ -8,7 +8,7 @@
     VerticalExpand="False"
     VerticalAlignment="Bottom"
     HorizontalAlignment="Center">
-    <controls:RecordedSplitContainer Name="ScreenContainer" HorizontalExpand="True"
+    <SplitContainer Name="ScreenContainer" HorizontalExpand="True"
                                      VerticalExpand="True" SplitWidth="0"
                                      StretchDirection="TopLeft">
         <BoxContainer Orientation="Vertical" VerticalExpand="True" Name="SpawnContainer" MinWidth="200" SetWidth="600">
@@ -82,5 +82,5 @@
                 </BoxContainer>
             </PanelContainer>
         </LayoutContainer>
-    </controls:RecordedSplitContainer>
+    </SplitContainer>
 </mapping:MappingScreen>
index 46c0e51fad69b4c17b057bb973e531ed2fce4b11..20e2528a44003eb85ec022546ae0db274eebe779 100644 (file)
@@ -197,7 +197,6 @@ public sealed partial class MappingScreen : InGameScreen
 
     public override void SetChatSize(Vector2 size)
     {
-        ScreenContainer.DesiredSplitCenter = size.X;
         ScreenContainer.ResizeMode = SplitContainer.SplitResizeMode.RespectChildrenMinSize;
     }
 
diff --git a/Content.Client/UserInterface/Controls/RecordedSplitContainer.cs b/Content.Client/UserInterface/Controls/RecordedSplitContainer.cs
deleted file mode 100644 (file)
index fd217bc..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Numerics;
-using Robust.Client.UserInterface.Controls;
-
-namespace Content.Client.UserInterface.Controls;
-
-/// <summary>
-///     A split container that performs an action when the split resizing is finished.
-/// </summary>
-public sealed class RecordedSplitContainer : SplitContainer
-{
-    public double? DesiredSplitCenter;
-
-    protected override Vector2 ArrangeOverride(Vector2 finalSize)
-    {
-        if (ResizeMode == SplitResizeMode.RespectChildrenMinSize
-            && DesiredSplitCenter != null
-            && !finalSize.Equals(Vector2.Zero))
-        {
-            SplitFraction = (float) DesiredSplitCenter.Value;
-
-            if (!Size.Equals(Vector2.Zero))
-            {
-                DesiredSplitCenter = null;
-            }
-        }
-
-        return base.ArrangeOverride(finalSize);
-    }
-}
index 7f1d1bcd5b19a1c2cea1d0063aa51886b35cf3ed..653302fae4c1fd39f956d4cf1ef4cc030c8cfe67 100644 (file)
@@ -14,7 +14,7 @@
     VerticalExpand="False"
     VerticalAlignment="Bottom"
     HorizontalAlignment="Center">
-    <controls:RecordedSplitContainer Name="ScreenContainer" HorizontalExpand="True" VerticalExpand="True" SplitWidth="0" StretchDirection="TopLeft">
+    <SplitContainer Name="ScreenContainer" HorizontalExpand="True" VerticalExpand="True" SplitWidth="0" StretchDirection="TopLeft">
         <LayoutContainer Name="ViewportContainer" HorizontalExpand="True" VerticalExpand="True">
             <controls:MainViewport Name="MainViewport"/>
             <widgets:GhostGui Name="Ghost" Access="Protected" />
@@ -26,7 +26,7 @@
             </BoxContainer>
             <alerts:AlertsUI Name="Alerts" Access="Protected" />
         </LayoutContainer>
-        <PanelContainer HorizontalExpand="True" MinWidth="300">
+        <PanelContainer Name="SeparatedChatPanel" MinWidth="300">
             <PanelContainer.PanelOverride>
                 <graphics:StyleBoxFlat BackgroundColor="#2B2C3B" />
             </PanelContainer.PanelOverride>
@@ -36,5 +36,5 @@
                 <chat:ChatBox VerticalExpand="True" HorizontalExpand="True" Name="Chat" Access="Protected" MinSize="0 0"/>
             </BoxContainer>
         </PanelContainer>
-    </controls:RecordedSplitContainer>
+    </SplitContainer>
 </screens:SeparatedChatGameScreen>
index e04d377d321586751020b768fb87fe82c0b277a3..2892ca44254d50212e636cc0cd51e5a9317f004f 100644 (file)
@@ -40,7 +40,6 @@ public sealed partial class SeparatedChatGameScreen : InGameScreen
 
     public override void SetChatSize(Vector2 size)
     {
-        ScreenContainer.DesiredSplitCenter = size.X;
         ScreenContainer.ResizeMode = SplitContainer.SplitResizeMode.RespectChildrenMinSize;
     }
 }