mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
* UI layout v2. All controls now act like containers. Moved anchor/margin layout model to LayoutContainer Implement basic WPF-like attached properties for the above LayoutContainer. * Fix VV.
22 lines
585 B
C#
22 lines
585 B
C#
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.Client.UserInterface.Controls
|
|
{
|
|
/// <summary>
|
|
/// Container type that centers its children inside itself.
|
|
/// </summary>
|
|
public class CenterContainer : Container
|
|
{
|
|
protected override void LayoutUpdateOverride()
|
|
{
|
|
foreach (var child in Children)
|
|
{
|
|
var childSize = child.CombinedMinimumSize;
|
|
var childPos = (Size - childSize) / 2;
|
|
|
|
FitChildInBox(child, UIBox2.FromDimensions(childPos, childSize));
|
|
}
|
|
}
|
|
}
|
|
}
|