Merge FlexContainer, WIP dynamic container resizing.
This commit is contained in:
@@ -15,7 +15,15 @@ public abstract class Container : IElement, IParentableElement, IUpdatableElemen
|
||||
/// <inheritdoc />
|
||||
public Rect MinimumRect { get; set; } = Rect.Zero;
|
||||
/// <inheritdoc />
|
||||
public Rect Size { get; set; } = Rect.Zero;
|
||||
public Rect Size
|
||||
{
|
||||
get => _size;
|
||||
set
|
||||
{
|
||||
_size = value;
|
||||
MarkDirty();
|
||||
}
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public bool Visible { get; set; } = true;
|
||||
/// <inheritdoc />
|
||||
@@ -71,7 +79,7 @@ public abstract class Container : IElement, IParentableElement, IUpdatableElemen
|
||||
{
|
||||
if (Children.Count == 0)
|
||||
{
|
||||
Size = MinimumRect;
|
||||
_size = MinimumRect;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +107,7 @@ public abstract class Container : IElement, IParentableElement, IUpdatableElemen
|
||||
float finalWidth = MathF.Max(occupiedWidth, MinimumRect.Width);
|
||||
float finalHeight = MathF.Max(occupiedHeight, MinimumRect.Height);
|
||||
|
||||
Size = new Rect(finalWidth, finalHeight);
|
||||
MinimumRect = new Rect(finalWidth, finalHeight);
|
||||
}
|
||||
|
||||
public void AddChild(IElement child)
|
||||
@@ -135,4 +143,5 @@ public abstract class Container : IElement, IParentableElement, IUpdatableElemen
|
||||
|
||||
private List<IElement> _children = new();
|
||||
private bool _isDirty;
|
||||
private Rect _size = Rect.Zero;
|
||||
}
|
||||
Reference in New Issue
Block a user