diff --git a/src/CommunityToolkit.Maui.Maps/Handler/Map/MapHandler.Windows.cs b/src/CommunityToolkit.Maui.Maps/Handler/Map/MapHandler.Windows.cs index ac60f4e73..71d8492e9 100644 --- a/src/CommunityToolkit.Maui.Maps/Handler/Map/MapHandler.Windows.cs +++ b/src/CommunityToolkit.Maui.Maps/Handler/Map/MapHandler.Windows.cs @@ -170,7 +170,7 @@ protected override void DisconnectHandler(FrameworkElement platformView) mapHandler.regionToGo = newRegion; } - CallJSMethod(handler.PlatformView, $"setRegion({newRegion.Center.Latitude.ToString(CultureInfo.InvariantCulture)},{newRegion.Center.Longitude.ToString(CultureInfo.InvariantCulture)});"); + CallJSMethod(handler.PlatformView, $"setRegion({newRegion.Center.Latitude.ToString(CultureInfo.InvariantCulture)},{newRegion.Center.Longitude.ToString(CultureInfo.InvariantCulture)},{newRegion.LatitudeDegrees.ToString(CultureInfo.InvariantCulture)},{newRegion.LongitudeDegrees.ToString(CultureInfo.InvariantCulture)});"); } static void CallJSMethod(FrameworkElement platformWebView, string script) @@ -290,11 +290,9 @@ function setMapType(mauiMapType) }); } - function setRegion(latitude, longitude) + function setRegion(latitude, longitude, latitudeDegrees, longitudeDegrees) { - map.setView({ - center: new Microsoft.Maps.Location(latitude, longitude), - }); + map.setView({bounds: new Microsoft.Maps.LocationRect(new Microsoft.Maps.Location(latitude, longitude), latitudeDegrees, longitudeDegrees) }); } function addLocationPin(latitude, longitude)