mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
trying to fix infinite settings updates
This commit is contained in:
@@ -258,7 +258,6 @@
|
||||
x:Uid="LightSwitch_LatitudeBox"
|
||||
Maximum="90"
|
||||
Minimum="-90"
|
||||
PlaceholderText="52"
|
||||
Text="{x:Bind ViewModel.Latitude, Mode=TwoWay}"
|
||||
ValueChanged="LatLonBox_ValueChanged" />
|
||||
<NumberBox
|
||||
@@ -267,7 +266,6 @@
|
||||
Grid.Column="1"
|
||||
Maximum="180"
|
||||
Minimum="-180"
|
||||
PlaceholderText="6"
|
||||
Text="{x:Bind ViewModel.Longitude, Mode=TwoWay}"
|
||||
ValueChanged="LatLonBox_ValueChanged" />
|
||||
<Button
|
||||
|
||||
@@ -157,6 +157,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
double lat = (double)LatitudeBox.Value;
|
||||
double lon = (double)LongitudeBox.Value;
|
||||
|
||||
double.TryParse(ViewModel.Latitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double currentLat);
|
||||
double.TryParse(ViewModel.Longitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double currentLon);
|
||||
|
||||
// If the new values are the same as the current ones (within tolerance), do nothing
|
||||
if (Math.Abs(lat - currentLat) < 0.0001 && Math.Abs(lon - currentLon) < 0.0001)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Optional: Validate ranges
|
||||
if (lat < -90 || lat > 90 || lon < -180 || lon > 180)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user