Browse Source

Add NearlyEquals for Size.

pull/4132/head
Dariusz Komosinski 6 years ago
parent
commit
55d9def9bc
  1. 12
      src/Avalonia.Visuals/Size.cs

12
src/Avalonia.Visuals/Size.cs

@ -189,7 +189,7 @@ namespace Avalonia
}
/// <summary>
/// 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).
/// </summary>
/// <param name="other">The other size to test equality against.</param>
/// <returns>True if this size is equal to other; False otherwise.</returns>
@ -201,6 +201,16 @@ namespace Avalonia
// ReSharper enable CompareOfFloatsByEqualityOperator
}
/// <summary>
/// Returns a boolean indicating whether the size is equal to the other given size (numerically).
/// </summary>
/// <param name="other">The other size to test equality against.</param>
/// <returns>True if this size is equal to other; False otherwise.</returns>
public bool NearlyEquals(Size other)
{
return MathUtilities.AreClose(_width, other._width) && MathUtilities.AreClose(_height, other._height);
}
/// <summary>
/// Checks for equality between a size and an object.
/// </summary>

Loading…
Cancel
Save