Browse Source

remove regions.

pull/4252/head
Dan Walmsley 6 years ago
parent
commit
0001578f0c
  1. 32
      src/Avalonia.Controls/RelativePanel.cs

32
src/Avalonia.Controls/RelativePanel.cs

@ -31,8 +31,6 @@ namespace Avalonia.Controls
protected override Size MeasureOverride(Size availableSize)
{
#region Calc DesiredSize
_childGraph.Clear();
foreach (Layoutable child in Children)
{
@ -56,17 +54,11 @@ namespace Avalonia.Controls
}
_childGraph.Measure(availableSize);
#endregion
#region Calc AvailableSize
_childGraph.Reset();
var boundingSize = _childGraph.GetBoundingSize(Width.IsNaN(), Height.IsNaN());
_childGraph.Reset();
_childGraph.Measure(boundingSize);
return boundingSize;
#endregion
}
protected override Size ArrangeOverride(Size arrangeSize)
@ -305,8 +297,6 @@ namespace Avalonia.Controls
var alignRightWithPanel = GetAlignRightWithPanel(child);
var alignBottomWithPanel = GetAlignBottomWithPanel(child);
#region Panel alignment
if (alignLeftWithPanel)
node.Left = 0;
if (alignTopWithPanel)
@ -316,10 +306,6 @@ namespace Avalonia.Controls
if (alignBottomWithPanel)
node.Bottom = 0;
#endregion
#region Sibling alignment
if (node.AlignLeftWithNode != null)
{
node.Left = node.Left.IsNaN() ? node.AlignLeftWithNode.Left : node.AlignLeftWithNode.Left * 0.5;
@ -344,10 +330,6 @@ namespace Avalonia.Controls
: node.AlignBottomWithNode.Bottom * 0.5;
}
#endregion
#region Measure
var availableHeight = AvailableSize.Height - node.Top - node.Bottom;
if (availableHeight.IsNaN())
{
@ -381,10 +363,6 @@ namespace Avalonia.Controls
child.Measure(new Size(Math.Max(availableWidth, 0), Math.Max(availableHeight, 0)));
var childSize = child.DesiredSize;
#endregion
#region Sibling positional
if (node.LeftOfNode != null && node.Left.IsNaN())
{
node.Left = node.LeftOfNode.Left - childSize.Width;
@ -421,10 +399,6 @@ namespace Avalonia.Controls
}
}
#endregion
#region Sibling-center alignment
if (node.AlignHorizontalCenterWith != null)
{
var halfWidthLeft = (AvailableSize.Width + node.AlignHorizontalCenterWith.Left - node.AlignHorizontalCenterWith.Right - childSize.Width) * 0.5;
@ -457,10 +431,6 @@ namespace Avalonia.Controls
node.Bottom = (node.Bottom + halfHeightBottom) * 0.5;
}
#endregion
#region Panel-center alignment
if (GetAlignHorizontalCenterWithPanel(child))
{
var halfSubWidth = (AvailableSize.Width - childSize.Width) * 0.5;
@ -491,8 +461,6 @@ namespace Avalonia.Controls
node.Bottom = (node.Bottom + halfSubHeight) * 0.5;
}
#endregion
if (node.Left.IsNaN())
{
if (!node.Right.IsNaN())

Loading…
Cancel
Save