Skip to content

Commit 63c0618

Browse files
authored
Fixes [BUG] Map not responding to span (zoom) requests in Windows #1686 (#2323)
1 parent 341c4c4 commit 63c0618

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/CommunityToolkit.Maui.Maps/Handler/Map/MapHandler.Windows.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected override void DisconnectHandler(FrameworkElement platformView)
170170
mapHandler.regionToGo = newRegion;
171171
}
172172

173-
CallJSMethod(handler.PlatformView, $"setRegion({newRegion.Center.Latitude.ToString(CultureInfo.InvariantCulture)},{newRegion.Center.Longitude.ToString(CultureInfo.InvariantCulture)});");
173+
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)});");
174174
}
175175

176176
static void CallJSMethod(FrameworkElement platformWebView, string script)
@@ -290,11 +290,9 @@ function setMapType(mauiMapType)
290290
});
291291
}
292292
293-
function setRegion(latitude, longitude)
293+
function setRegion(latitude, longitude, latitudeDegrees, longitudeDegrees)
294294
{
295-
map.setView({
296-
center: new Microsoft.Maps.Location(latitude, longitude),
297-
});
295+
map.setView({bounds: new Microsoft.Maps.LocationRect(new Microsoft.Maps.Location(latitude, longitude), latitudeDegrees, longitudeDegrees) });
298296
}
299297
300298
function addLocationPin(latitude, longitude)

0 commit comments

Comments
 (0)