Skip to content

Commit

Permalink
messure collaped children without spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Poker-sang committed Feb 2, 2025
1 parent 51e0eaa commit d9c88a1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Avalonia.Controls/DockPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,23 @@ protected override Size MeasureOverride(Size availableSize)
{
case Dock.Left:
case Dock.Right:
horizontalSpacing = true;
parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height);
accumulatedWidth += HorizontalSpacing;
if (!child.IsVisible)
{
accumulatedWidth += HorizontalSpacing;
horizontalSpacing = true;
}
accumulatedWidth += childDesiredSize.Width;
break;

case Dock.Top:
case Dock.Bottom:
verticalSpacing = true;
parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width);
accumulatedHeight += VerticalSpacing;
if (!child.IsVisible)
{
accumulatedHeight += VerticalSpacing;
verticalSpacing = true;
}
accumulatedHeight += childDesiredSize.Height;
break;
}
Expand Down

0 comments on commit d9c88a1

Please sign in to comment.