mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 15:36:20 +00:00
Changed class Location to readonly struct
This commit is contained in:
parent
d7d7bba5f2
commit
6566167ff0
27 changed files with 194 additions and 307 deletions
|
|
@ -5,28 +5,12 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// Replaces Windows.Foundation.Rect for double floating point precision.
|
||||
/// </summary>
|
||||
public readonly struct Rect : IEquatable<Rect>
|
||||
public readonly struct Rect(double x, double y, double width, double height) : IEquatable<Rect>
|
||||
{
|
||||
public Rect(double x, double y, double width, double height)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
public Rect(Point p1, Point p2)
|
||||
{
|
||||
X = Math.Min(p1.X, p2.X);
|
||||
Y = Math.Min(p1.Y, p2.Y);
|
||||
Width = Math.Max(p1.X, p2.X) - X;
|
||||
Height = Math.Max(p1.Y, p2.Y) - Y;
|
||||
}
|
||||
|
||||
public double X { get; }
|
||||
public double Y { get; }
|
||||
public double Width { get; }
|
||||
public double Height { get; }
|
||||
public double X => x;
|
||||
public double Y => y;
|
||||
public double Width => width;
|
||||
public double Height => height;
|
||||
|
||||
public static implicit operator Windows.Foundation.Rect(Rect r) => new(r.X, r.Y, r.Width, r.Height);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue