Fix clipping/overlap in lathe machine UIs (#26646)

* 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>
This commit is contained in:
eoineoineoin
2024-04-01 09:36:07 +01:00
committed by GitHub
parent 5e15abc5ed
commit a05f95269f
3 changed files with 10 additions and 11 deletions

View File

@@ -124,9 +124,7 @@
<BoxContainer <BoxContainer
VerticalExpand="True" VerticalExpand="True"
HorizontalExpand="True" HorizontalExpand="True"
Orientation="Vertical" Orientation="Vertical">
MinHeight="225"
>
<Label Text="{Loc 'lathe-menu-materials-title'}" Margin="5 5 5 5" HorizontalAlignment="Center"/> <Label Text="{Loc 'lathe-menu-materials-title'}" Margin="5 5 5 5" HorizontalAlignment="Center"/>
<BoxContainer <BoxContainer
Orientation="Vertical" Orientation="Vertical"

View File

@@ -1,7 +1,8 @@
<BoxContainer xmlns="https://spacestation14.io" <ScrollContainer xmlns="https://spacestation14.io"
Orientation="Vertical"
SizeFlagsStretchRatio="8" SizeFlagsStretchRatio="8"
HorizontalExpand="True" HorizontalExpand="True"
VerticalExpand="True"> VerticalExpand="True">
<BoxContainer Name="MaterialList" Orientation="Vertical">
<Label Name="NoMatsLabel" Text="{Loc 'lathe-menu-no-materials-message'}" Align="Center"/> <Label Name="NoMatsLabel" Text="{Loc 'lathe-menu-no-materials-message'}" Align="Center"/>
</BoxContainer> </BoxContainer>
</ScrollContainer>

View File

@@ -11,7 +11,7 @@ namespace Content.Client.Materials.UI;
/// This widget is one row in the lathe eject menu. /// This widget is one row in the lathe eject menu.
/// </summary> /// </summary>
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class MaterialStorageControl : BoxContainer public sealed partial class MaterialStorageControl : ScrollContainer
{ {
[Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!;
@@ -63,7 +63,7 @@ public sealed partial class MaterialStorageControl : BoxContainer
} }
var children = new List<MaterialDisplay>(); var children = new List<MaterialDisplay>();
children.AddRange(Children.OfType<MaterialDisplay>()); children.AddRange(MaterialList.Children.OfType<MaterialDisplay>());
foreach (var display in children) foreach (var display in children)
{ {
@@ -71,7 +71,7 @@ public sealed partial class MaterialStorageControl : BoxContainer
if (extra.Contains(mat)) if (extra.Contains(mat))
{ {
RemoveChild(display); MaterialList.RemoveChild(display);
continue; continue;
} }
@@ -83,7 +83,7 @@ public sealed partial class MaterialStorageControl : BoxContainer
foreach (var mat in missing) foreach (var mat in missing)
{ {
var volume = mats[mat]; var volume = mats[mat];
AddChild(new MaterialDisplay(_owner.Value, mat, volume, canEject)); MaterialList.AddChild(new MaterialDisplay(_owner.Value, mat, volume, canEject));
} }
_currentMaterials = mats; _currentMaterials = mats;