Skip to content

Commit

Permalink
chore: Adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Oct 12, 2024
1 parent 4418083 commit d5d9aac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Uno.UI/UI/Xaml/MobileLayoutingHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static Size MeasureElement(View view, Size availableSize)

if (view is ILayouterElement layouterElement)
{
var desiredSizeFromLayouterElement = layouterElement.Measure(availableSize);
var desiredSizeFromLayouterElement = layouterElement.Measure(availableSize).AtMost(availableSize);
LayoutInformation.SetDesiredSize(view, desiredSizeFromLayouterElement);
LayoutInformation.SetAvailableSize(view, availableSize);

Expand All @@ -64,7 +64,7 @@ public static Size MeasureElement(View view, Size availableSize)
var widthSpec = ViewHelper.SpecFromLogicalSize(availableSize.Width);
var heightSpec = ViewHelper.SpecFromLogicalSize(availableSize.Height);
view.Measure(widthSpec, heightSpec);
var desiredSize = Uno.UI.Controls.BindableView.GetNativeMeasuredDimensionsFast(view).PhysicalToLogicalPixels();
var desiredSize = Uno.UI.Controls.BindableView.GetNativeMeasuredDimensionsFast(view).PhysicalToLogicalPixels().AtMost(availableSize);
LayoutInformation.SetDesiredSize(view, desiredSize);
LayoutInformation.SetAvailableSize(view, availableSize);

Expand Down Expand Up @@ -94,14 +94,16 @@ public static Size MeasureElement(View view, Size availableSize)
#elif __IOS__ || __MACOS__

#if __IOS__
var desiredSize = view.SizeThatFits(availableSize);
Size desiredSize = view.SizeThatFits(availableSize);
desiredSize = desiredSize.AtMost(availableSize);
#else
CGSize desiredSize = view switch
Size desiredSize = view switch
{
NSControl nsControl => nsControl.SizeThatFits(availableSize),
IHasSizeThatFits hasSizeThatFits => hasSizeThatFits.SizeThatFits(availableSize),
_ => view.FittingSize,
};
desiredSize = desiredSize.AtMost(availableSize);
#endif

LayoutInformation.SetDesiredSize(view, desiredSize);
Expand Down

0 comments on commit d5d9aac

Please sign in to comment.