From f143bdb5e6a055077f58117b69f4cadc0b4090fd Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Mon, 9 Sep 2024 16:26:37 +0200 Subject: [PATCH] Update Rect.WinUI.cs --- MapControl/WinUI/Rect.WinUI.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MapControl/WinUI/Rect.WinUI.cs b/MapControl/WinUI/Rect.WinUI.cs index 7399024a..10e1deb0 100644 --- a/MapControl/WinUI/Rect.WinUI.cs +++ b/MapControl/WinUI/Rect.WinUI.cs @@ -2,6 +2,8 @@ // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) +using System; + namespace MapControl { /// @@ -17,10 +19,12 @@ namespace MapControl Height = height; } - public Rect(Point p1, Point p2) - : this(p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y) { + 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; }