]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix clipping/overlap in lathe machine UIs (#26646)
authoreoineoineoin <github@eoinrul.es>
Mon, 1 Apr 2024 08:36:07 +0000 (09:36 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Apr 2024 08:36:07 +0000 (19:36 +1100)
* Add scrollbars to lathe material list when necessary

* Fix bug where shrinking window would cause elements to overlap

---------

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
Content.Client/Lathe/UI/LatheMenu.xaml
Content.Client/Materials/UI/MaterialStorageControl.xaml
Content.Client/Materials/UI/MaterialStorageControl.xaml.cs

index 2b97166f05a67ba5a541e5203f5dfa26caf2ca4f..6f484d8c7be8286395dce5a9256a217cd33d4200 100644 (file)
             <BoxContainer
             VerticalExpand="True"
             HorizontalExpand="True"
-            Orientation="Vertical"
-            MinHeight="225"
-            >
+            Orientation="Vertical">
             <Label Text="{Loc 'lathe-menu-materials-title'}" Margin="5 5 5 5" HorizontalAlignment="Center"/>
             <BoxContainer
                 Orientation="Vertical"
index e50443464934f5d12f5cd87c9a5d2942b1abc462..2be0f40aa51a4eafe4925817ec50650327d49869 100644 (file)
@@ -1,7 +1,8 @@
-<BoxContainer xmlns="https://spacestation14.io"
-              Orientation="Vertical"
+<ScrollContainer xmlns="https://spacestation14.io"
               SizeFlagsStretchRatio="8"
               HorizontalExpand="True"
               VerticalExpand="True">
-    <Label Name="NoMatsLabel" Text="{Loc 'lathe-menu-no-materials-message'}" Align="Center"/>
-</BoxContainer>
+    <BoxContainer Name="MaterialList" Orientation="Vertical">
+        <Label Name="NoMatsLabel" Text="{Loc 'lathe-menu-no-materials-message'}" Align="Center"/>
+    </BoxContainer>
+</ScrollContainer>
index 3ef247d52978d3668e6fbbe9eac89b202088a3c2..31d99624a8a7bc535affb838f4a1672dba4354b7 100644 (file)
@@ -11,7 +11,7 @@ namespace Content.Client.Materials.UI;
 /// This widget is one row in the lathe eject menu.
 /// </summary>
 [GenerateTypedNameReferences]
-public sealed partial class MaterialStorageControl : BoxContainer
+public sealed partial class MaterialStorageControl : ScrollContainer
 {
     [Dependency] private readonly IEntityManager _entityManager = default!;
 
@@ -63,7 +63,7 @@ public sealed partial class MaterialStorageControl : BoxContainer
         }
 
         var children = new List<MaterialDisplay>();
-        children.AddRange(Children.OfType<MaterialDisplay>());
+        children.AddRange(MaterialList.Children.OfType<MaterialDisplay>());
 
         foreach (var display in children)
         {
@@ -71,7 +71,7 @@ public sealed partial class MaterialStorageControl : BoxContainer
 
             if (extra.Contains(mat))
             {
-                RemoveChild(display);
+                MaterialList.RemoveChild(display);
                 continue;
             }
 
@@ -83,7 +83,7 @@ public sealed partial class MaterialStorageControl : BoxContainer
         foreach (var mat in missing)
         {
             var volume = mats[mat];
-            AddChild(new MaterialDisplay(_owner.Value, mat, volume, canEject));
+            MaterialList.AddChild(new MaterialDisplay(_owner.Value, mat, volume, canEject));
         }
 
         _currentMaterials = mats;