Skip to content

Commit

Permalink
FIX layout for Fill with Infinity case
Browse files Browse the repository at this point in the history
  • Loading branch information
taublast committed Nov 5, 2024
1 parent f67b37a commit c6687bd
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3213,6 +3213,7 @@ public virtual void Arrange(SKRect destination, float widthRequest, float height

protected virtual void PostArrange(SKRect destination, float widthRequest, float heightRequest, float scale)
{
//create area to arrange inside
SKRect arrangingFor = new(0, 0, destination.Width, destination.Height);

if (!IsLayoutDirty &&
Expand Down Expand Up @@ -3244,7 +3245,6 @@ protected virtual void PostArrange(SKRect destination, float widthRequest, float

//save to cache
ArrangedDestination = layout;
//ArrangedDrawingRect = GetDrawingRectWithMargins(layout, scale);

AdaptCachedLayout(destination, scale);

Expand All @@ -3267,7 +3267,6 @@ protected virtual void PostArrange(SKRect destination, float widthRequest, float

IsLayoutDirty = false;
}

/// <summary>
/// PIXELS
/// </summary>
Expand Down Expand Up @@ -3417,11 +3416,11 @@ void PostProcessMeasuredChild(ScaledSize measured, SkiaControl child, bool ignor
heightCut |= measured.HeightCut;
}

if (HorizontalOptions.Alignment == LayoutAlignment.Fill && WidthRequest < 0)
if (HorizontalOptions.Alignment == LayoutAlignment.Fill && WidthRequest < 0 && !float.IsInfinity(rectForChildrenPixels.Width))
{
maxWidth = rectForChildrenPixels.Width;
}
if (VerticalOptions.Alignment == LayoutAlignment.Fill && HeightRequest < 0)
if (VerticalOptions.Alignment == LayoutAlignment.Fill && HeightRequest < 0 && !float.IsInfinity(rectForChildrenPixels.Height))
{
maxHeight = rectForChildrenPixels.Height;
}
Expand Down Expand Up @@ -3559,7 +3558,6 @@ public virtual ScaledSize SetMeasuredAdaptToContentSize(MeasuringConstraints con
}



[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static SKSize GetSizeInPoints(SKSize size, float scale)
{
Expand Down Expand Up @@ -3684,7 +3682,6 @@ protected ScaledSize MeasureAbsoluteBase(SKRect rectForChildrenPixels, float sca
return ScaledSize.FromPixels(rectForChildrenPixels.Width, rectForChildrenPixels.Height, scale);
}


public static SKRect ContractPixelsRect(SKRect rect, float scale, Thickness amount)
{
return new SKRect(
Expand Down

0 comments on commit c6687bd

Please sign in to comment.