From 288d9294778475535d488855ba7b8a04f95f1c3b Mon Sep 17 00:00:00 2001 From: Arjun Balgovind <32061677+arjunbalgovind@users.noreply.github.com> Date: Thu, 3 Sep 2020 13:43:55 -0700 Subject: [PATCH] [Settings] Changed ImageSize class to parse as double instead of int (#6299) * Changed ImageSize class to parse as double instead of int * Tweaked fix to resolve empty ImageResizer box fix --- .../ImageSize.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/ImageSize.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/ImageSize.cs index a1519e1a5d..24c0910f46 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/ImageSize.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/ImageSize.cs @@ -141,15 +141,18 @@ namespace Microsoft.PowerToys.Settings.UI.Lib set { - int newWidth = -1; - int.TryParse(value + string.Empty, out newWidth); + double newWidth = -1; - if (newWidth < 0) + if (value < 0 || double.IsNaN(value)) { newWidth = 0; } + else + { + newWidth = value; + } - if (_width != value) + if (_width != newWidth) { _width = newWidth; OnPropertyChanged(); @@ -167,15 +170,18 @@ namespace Microsoft.PowerToys.Settings.UI.Lib set { - int newHeight = -1; - int.TryParse(value + string.Empty, out newHeight); + double newHeight = -1; - if (newHeight < 0) + if (value < 0 || double.IsNaN(value)) { newHeight = 0; } + else + { + newHeight = value; + } - if (_height != value) + if (_height != newHeight) { _height = newHeight; OnPropertyChanged();