Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Window/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void IWindow.FrameChanged(Rect frame)
var y = Y;
var width = Width;
var height = Height;
if (new Rect(x, y, width, height) == frame)
if (!double.IsNaN(width) && !double.IsNaN(height) && new Rect(x, y, width, height) == frame)
Comment thread
BioTurboNick marked this conversation as resolved.
Outdated
return;

_batchFrameUpdate++;
Expand Down
29 changes: 27 additions & 2 deletions src/Graphics/src/Graphics/Rect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,34 @@ namespace Microsoft.Maui.Graphics
[TypeConverter(typeof(Converters.RectTypeConverter))]
public partial struct Rect
{
double _Height;
Comment thread
BioTurboNick marked this conversation as resolved.
Outdated
double _Width;
Comment thread
BioTurboNick marked this conversation as resolved.
Outdated

public double X { get; set; }

public double Y { get; set; }

public double Width { get; set; }
public double Width
{
get => _Width;
set
{
if (double.IsNaN(value))
throw new ArgumentOutOfRangeException(nameof(value), value, "Cannot be NaN");
_Width = value;
}
}

public double Height { get; set; }
public double Height
{
get => _Height;
set
{
if (double.IsNaN(value))
throw new ArgumentOutOfRangeException(nameof(value), value, "Cannot be NaN");
_Height = value;
}
}

public static Rect Zero = new Rect();

Expand All @@ -27,6 +48,10 @@ public override string ToString()
// constructors
public Rect(double x, double y, double width, double height) : this()
{
if (double.IsNaN(width))
Comment thread
BioTurboNick marked this conversation as resolved.
Outdated
throw new ArgumentOutOfRangeException(nameof(width), width, "Cannot be NaN");
if (double.IsNaN(height))
throw new ArgumentOutOfRangeException(nameof(height), height, "Cannot be NaN");
X = x;
Y = y;
Width = width;
Expand Down