Skip to content

Commit

Permalink
Fix clipping/overlap in lathe machine UIs (space-wizards#26646)
Browse files Browse the repository at this point in the history
* Add scrollbars to lathe material list when necessary

* Fix bug where shrinking window would cause elements to overlap

---------

Co-authored-by: Eoin Mcloughlin <[email protected]>
  • Loading branch information
eoineoineoin and eoineoineoin authored Apr 1, 2024
1 parent 5e15abc commit a05f952
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions Content.Client/Lathe/UI/LatheMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions Content.Client/Materials/UI/MaterialStorageControl.xaml
Original file line number Diff line number Diff line change
@@ -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>
8 changes: 4 additions & 4 deletions Content.Client/Materials/UI/MaterialStorageControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!;

Expand Down Expand Up @@ -63,15 +63,15 @@ protected override void FrameUpdate(FrameEventArgs args)
}

var children = new List<MaterialDisplay>();
children.AddRange(Children.OfType<MaterialDisplay>());
children.AddRange(MaterialList.Children.OfType<MaterialDisplay>());

foreach (var display in children)
{
var mat = display.Material;

if (extra.Contains(mat))
{
RemoveChild(display);
MaterialList.RemoveChild(display);
continue;
}

Expand All @@ -83,7 +83,7 @@ protected override void FrameUpdate(FrameEventArgs args)
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;
Expand Down

0 comments on commit a05f952

Please sign in to comment.