protected override Vector2 ArrangeOverride(Vector2 finalSize)
{
if (ResizeMode == SplitResizeMode.RespectChildrenMinSize
- && DesiredSplitCenter != null)
+ && DesiredSplitCenter != null
+ && !finalSize.Equals(Vector2.Zero))
{
- var secondMin = GetChild(1).DesiredSize;
- double minSize = Orientation == SplitOrientation.Vertical
- ? secondMin.Y
- : secondMin.X;
- double finalSizeComponent = Orientation == SplitOrientation.Vertical
- ? finalSize.Y
- : finalSize.X;
+ SplitFraction = (float) DesiredSplitCenter.Value;
- var firstTotalFractional = (finalSizeComponent - minSize - SplitWidth - SplitEdgeSeparation) / finalSizeComponent;
- DesiredSplitCenter = Math.Round(DesiredSplitCenter.Value, 2, MidpointRounding.ToZero);
-
- // total space the split center takes up must fit the available space percentage given to the first child
- var canFirstFit = DesiredSplitCenter <= firstTotalFractional;
-
- if (DesiredSplitCenter > 1 || DesiredSplitCenter < 0 || !canFirstFit)
- {
- DesiredSplitCenter = Math.Round(firstTotalFractional, 2, MidpointRounding.ToZero);
- }
-
- // don't need anything more than two digits of precision for this
- var currentSplitFraction = Math.Round(SplitFraction, 2, MidpointRounding.ToZero);
-
- // brute force it
- if (currentSplitFraction != DesiredSplitCenter.Value)
- {
- SplitFraction = (float) DesiredSplitCenter.Value;
- }
- else
+ if (!Size.Equals(Vector2.Zero))
{
DesiredSplitCenter = null;
}