* Always display item status panel fully Initial feedback from the UI changes seems to be that a lot of people go "why is there empty space" so let's fix that. * Fix item status middle hand being on the wrong side I think I switched this around when fixing the left/right being inverted in the UI code. * Minor status panel UI tweaks Bottom-align contents now that the panel itself doesn't dynamically expand, prevent weird gaps. Clip contents for panel * Fix clipping on implanters and network configurators. Made them take less space. For implanters the name has to be cut off, which I did by adding a new ClipControl to achieve that in rich text. * Update visibility of item status panels based on whether you have hands at all. This avoids UI for borgs looking silly. Added a new "HandUILocation" enum that doesn't have middle hands to avoid confusion in UI code. * Use BulletRender for laser guns too. Provides all the benefits like fixing layout overflow and allowing multi-line stuff. Looks great now. This involved generalizing BulletRender a bit so it can be used for not-just-bullets. * Fix geiger word wrapping if you're really fucked
56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System.Numerics;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
namespace Content.Client.UserInterface.Controls;
|
|
|
|
/// <summary>
|
|
/// Pretends to child controls that there's infinite space.
|
|
/// This can be used to make something like a <see cref="RichTextLabel"/> clip instead of wrapping.
|
|
/// </summary>
|
|
public sealed class ClipControl : Control
|
|
{
|
|
private bool _clipHorizontal = true;
|
|
private bool _clipVertical = true;
|
|
|
|
public bool ClipHorizontal
|
|
{
|
|
get => _clipHorizontal;
|
|
set
|
|
{
|
|
_clipHorizontal = value;
|
|
InvalidateMeasure();
|
|
}
|
|
}
|
|
|
|
public bool ClipVertical
|
|
{
|
|
get => _clipVertical;
|
|
set
|
|
{
|
|
_clipVertical = value;
|
|
InvalidateMeasure();
|
|
}
|
|
}
|
|
|
|
protected override Vector2 MeasureOverride(Vector2 availableSize)
|
|
{
|
|
if (ClipHorizontal)
|
|
availableSize = availableSize with { X = float.PositiveInfinity };
|
|
if (ClipVertical)
|
|
availableSize = availableSize with { Y = float.PositiveInfinity };
|
|
|
|
return base.MeasureOverride(availableSize);
|
|
}
|
|
|
|
protected override Vector2 ArrangeOverride(Vector2 finalSize)
|
|
{
|
|
foreach (var child in Children)
|
|
{
|
|
child.Arrange(UIBox2.FromDimensions(Vector2.Zero, child.DesiredSize));
|
|
}
|
|
|
|
return finalSize;
|
|
}
|
|
}
|