Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
hartez committed Jul 27, 2023
1 parent df7fd1a commit 7fa2f97
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/Controls/src/Core/ContentPage/ContentPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ protected override void InvalidateMeasureOverride()
IView IReplaceableView.ReplacedView => HotReload.MauiHotReloadHelper.GetReplacedView(this) ?? this;

HotReload.IReloadHandler HotReload.IHotReloadableView.ReloadHandler { get; set; }
Thickness IPadding.Padding { get; }

void HotReload.IHotReloadableView.TransferState(IView newView)
{
Expand Down
5 changes: 5 additions & 0 deletions src/Core/src/Core/IContentView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@ public interface IContentView : IView, IPadding, ICrossPlatformLayout
/// Implementing classes should implement the ICrossPlatformLayout interface rather than directly implementing this method.
/// </summary>
new Size CrossPlatformArrange(Rect bounds);

#if !NETSTANDARD2_0
Size ICrossPlatformLayout.CrossPlatformArrange(Microsoft.Maui.Graphics.Rect bounds) => CrossPlatformArrange(bounds);
Size ICrossPlatformLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) => CrossPlatformMeasure(widthConstraint, heightConstraint);
#endif
}
}
24 changes: 0 additions & 24 deletions src/Core/src/Core/ICrossPlatformLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,13 @@ public interface ICrossPlatformLayout
/// <param name="widthConstraint">The width limit for measuring the ICrossPlatformLayout.</param>
/// <param name="heightConstraint">The height limit for measuring the ICrossPlatformLayout.</param>
/// <returns>The desired size of the ILayout.</returns>
#if NETSTANDARD2_0
Size CrossPlatformMeasure(double widthConstraint, double heightConstraint);
#else
Size CrossPlatformMeasure(double widthConstraint, double heightConstraint)
{
return this switch
{
IContentView contentView => contentView.CrossPlatformMeasure(widthConstraint, heightConstraint),
ILayout layout => layout.CrossPlatformMeasure(widthConstraint, heightConstraint),
_ => Size.Zero,
};
}
#endif

/// <summary>
/// Arranges the children of the ICrossPlatformLayout within the given bounds.
/// </summary>
/// <param name="bounds">The bounds in which the ICrossPlatformLayout's children should be arranged.</param>
/// <returns>The actual size of the arranged ICrossPlatformLayout.</returns>
#if NETSTANDARD2_0
Size CrossPlatformArrange(Rect bounds);
#else
Size CrossPlatformArrange(Rect bounds)
{
return this switch
{
IContentView contentView => contentView.CrossPlatformArrange(bounds),
ILayout layout => layout.CrossPlatformArrange(bounds),
_ => Size.Zero,
};
}
#endif
}
}
5 changes: 5 additions & 0 deletions src/Core/src/Core/ILayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ public interface ILayout : IView, IContainer, ISafeAreaView, IPadding, ICrossPla
/// Implementing classes should implement the ICrossPlatformLayout interface rather than directly implementing this method.
/// </summary>
new Size CrossPlatformMeasure(double widthConstraint, double heightConstraint);

#if !NETSTANDARD2_0
Size ICrossPlatformLayout.CrossPlatformArrange(Microsoft.Maui.Graphics.Rect bounds) => CrossPlatformArrange(bounds);
Size ICrossPlatformLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) => CrossPlatformMeasure(widthConstraint, heightConstraint);
#endif
}
}

0 comments on commit 7fa2f97

Please sign in to comment.