|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Reactive.Concurrency; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Layout; |
|
|
|
|
|
|
|
@ -159,47 +160,57 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Arranges the control's children.
|
|
|
|
/// Arranges a single child.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="finalSize">The size allocated to the control.</param>
|
|
|
|
/// <returns>The space taken.</returns>
|
|
|
|
protected override Size ArrangeOverride(Size finalSize) |
|
|
|
/// <param name="child">The child to arrange.</param>
|
|
|
|
/// <param name="finalSize">The size allocated to the canvas.</param>
|
|
|
|
protected virtual void ArrangeChild(Control child, Size finalSize) |
|
|
|
{ |
|
|
|
foreach (Control child in Children) |
|
|
|
{ |
|
|
|
double x = 0.0; |
|
|
|
double y = 0.0; |
|
|
|
double elementLeft = GetLeft(child); |
|
|
|
double x = 0.0; |
|
|
|
double y = 0.0; |
|
|
|
double elementLeft = GetLeft(child); |
|
|
|
|
|
|
|
if (!double.IsNaN(elementLeft)) |
|
|
|
{ |
|
|
|
x = elementLeft; |
|
|
|
} |
|
|
|
else |
|
|
|
if (!double.IsNaN(elementLeft)) |
|
|
|
{ |
|
|
|
x = elementLeft; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// Arrange with right.
|
|
|
|
double elementRight = GetRight(child); |
|
|
|
if (!double.IsNaN(elementRight)) |
|
|
|
{ |
|
|
|
// Arrange with right.
|
|
|
|
double elementRight = GetRight(child); |
|
|
|
if (!double.IsNaN(elementRight)) |
|
|
|
{ |
|
|
|
x = finalSize.Width - child.DesiredSize.Width - elementRight; |
|
|
|
} |
|
|
|
x = finalSize.Width - child.DesiredSize.Width - elementRight; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
double elementTop = GetTop(child); |
|
|
|
if (!double.IsNaN(elementTop) ) |
|
|
|
{ |
|
|
|
y = elementTop; |
|
|
|
} |
|
|
|
else |
|
|
|
double elementTop = GetTop(child); |
|
|
|
if (!double.IsNaN(elementTop)) |
|
|
|
{ |
|
|
|
y = elementTop; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
double elementBottom = GetBottom(child); |
|
|
|
if (!double.IsNaN(elementBottom)) |
|
|
|
{ |
|
|
|
double elementBottom = GetBottom(child); |
|
|
|
if (!double.IsNaN(elementBottom)) |
|
|
|
{ |
|
|
|
y = finalSize.Height - child.DesiredSize.Height - elementBottom; |
|
|
|
} |
|
|
|
y = finalSize.Height - child.DesiredSize.Height - elementBottom; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
child.Arrange(new Rect(new Point(x, y), child.DesiredSize)); |
|
|
|
child.Arrange(new Rect(new Point(x, y), child.DesiredSize)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Arranges the control's children.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="finalSize">The size allocated to the control.</param>
|
|
|
|
/// <returns>The space taken.</returns>
|
|
|
|
protected override Size ArrangeOverride(Size finalSize) |
|
|
|
{ |
|
|
|
foreach (Control child in Children) |
|
|
|
{ |
|
|
|
ArrangeChild(child, finalSize); |
|
|
|
} |
|
|
|
|
|
|
|
return finalSize; |
|
|
|
|