WIP: layout with new panel.

This commit is contained in:
rabbitism
2024-01-04 20:33:42 +08:00
parent 1d6d8feaec
commit 66bc512ae2
7 changed files with 250 additions and 47 deletions

View File

@@ -25,19 +25,48 @@ public class TimelinePanel: Panel
double left = 0;
double right = 0;
double icon = 0;
double width = 0;
double height = 0;
foreach (var child in Children)
{
child.Measure(availableSize);
if (child is TimelineItem t)
{
var doubles = t.GetWidth();
}
width = Math.Max(width, child.DesiredSize.Width);
height+=child.DesiredSize.Height;
}
foreach (var child in Children)
{
if (child is TimelineItem t)
{
t.LeftWidth = left;
t.RightWidth = right;
t.IconWidth = icon;
}
}
return base.MeasureOverride(availableSize);
return new Size(width, height);
}
protected override Size ArrangeOverride(Size finalSize)
{
return base.ArrangeOverride(finalSize);
Rect rect = new Rect();
foreach (var child in Children)
{
rect = rect.WithWidth(Math.Max(rect.Width, child.DesiredSize.Width));
rect = rect.WithHeight(rect.Height + child.DesiredSize.Height);
child.Arrange(rect);
rect = rect.WithY(rect.Y+child.DesiredSize.Height);
if (child is TimelineItem t)
{
var doubles = t.GetWidth();
t.SetWidth(0, 0, 0, 0);
}
}
//return base.ArrangeOverride(finalSize);
return rect.Size;
}
}