namespace Voile.UI.Containers;

/// <summary>
/// A special container that occupies the entire available size of the parent. <br />
/// Usually used as a root element for the UI system.
/// </summary>
public class FillContainer : Container
{
    public override void Arrange()
    {
        // FillContainer does not position children.
        // Children handle their own layout or are absolute.
    }

    protected override void OnUpdate(LayoutContext layout)
    {
        Size = Parent != null
            ? Parent.Size
            : new Rect(layout.WindowSize.X, layout.WindowSize.Y);

        base.OnUpdate(layout);
    }
}