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
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"

View 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>

View 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;