UI WIP
This commit is contained in:
22
DaggerFramework/Source/UI/VerticalPanel.cs
Normal file
22
DaggerFramework/Source/UI/VerticalPanel.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace DaggerFramework.UI;
|
||||
|
||||
public class VerticalPanel : Panel
|
||||
{
|
||||
public float Spacing { get; set; } = 16;
|
||||
public VerticalPanel(PanelStyle style) : base(style)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RearrangeChild(int idx, UIElement child)
|
||||
{
|
||||
base.RearrangeChild(idx, child);
|
||||
|
||||
var yOffset = idx * Spacing;
|
||||
var rect = child.Rect;
|
||||
|
||||
rect.Position = Rect.Position;
|
||||
rect.Position = new Vector2(rect.Position.X, yOffset);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user