diff --git a/src/Avalonia.Visuals/Size.cs b/src/Avalonia.Visuals/Size.cs index 0383094a5b..860270b346 100644 --- a/src/Avalonia.Visuals/Size.cs +++ b/src/Avalonia.Visuals/Size.cs @@ -189,7 +189,7 @@ namespace Avalonia } /// - /// Returns a boolean indicating whether the size is equal to the other given size. + /// Returns a boolean indicating whether the size is equal to the other given size (bitwise). /// /// The other size to test equality against. /// True if this size is equal to other; False otherwise. @@ -201,6 +201,16 @@ namespace Avalonia // ReSharper enable CompareOfFloatsByEqualityOperator } + /// + /// Returns a boolean indicating whether the size is equal to the other given size (numerically). + /// + /// The other size to test equality against. + /// True if this size is equal to other; False otherwise. + public bool NearlyEquals(Size other) + { + return MathUtilities.AreClose(_width, other._width) && MathUtilities.AreClose(_height, other._height); + } + /// /// Checks for equality between a size and an object. ///