Location now immutable

This commit is contained in:
ClemensFischer 2024-04-11 13:21:38 +02:00
parent 52d990a89c
commit dc9932a0cf
5 changed files with 18 additions and 32 deletions

View file

@ -774,14 +774,17 @@ namespace MapControl
if (center != null)
{
center.Longitude = Location.NormalizeLongitude(center.Longitude);
var centerLatitude = center.Latitude;
var centerLongitude = Location.NormalizeLongitude(center.Longitude);
if (center.Latitude < -maxLatitude || center.Latitude > maxLatitude)
if (centerLatitude < -maxLatitude || centerLatitude > maxLatitude)
{
center.Latitude = Math.Min(Math.Max(center.Latitude, -maxLatitude), maxLatitude);
centerLatitude = Math.Min(Math.Max(centerLatitude, -maxLatitude), maxLatitude);
resetTransformCenter = true;
}
center = new Location(centerLatitude, centerLongitude);
SetValueInternal(CenterProperty, center);
if (centerAnimation == null)