forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Description
Create a custom map class and a handler for it, and inside that handler register for CameraMove events from the underlying GoogleMap (either via SetOnCameraMoveListener or the CameraMove event). When you do this, the Maui Map's VisibleRegion property no longer updates when you move the map. In particular, the Center property always returns the map's initial location.
Comment out the += to the CameraMove event, or the call to SetOnCameraMoveListener, and VisibleRegion.Center will update again. This is very broken, and it is a regression from Xamarin.Forms.
Steps to Reproduce
class CustomMapHandler : MapHandler
{
protected override void ConnectHandler(Android.Gms.Maps.MapView platformView)
{
base.ConnectHandler(platformView);
platformView.GetMapAsync(new CustomMapCallbackHandler(this));
}
internal void OnMapReady(Android.Gms.Maps.GoogleMap googleMap)
{
googleMap.CameraMove += this.OnCameraMoved;
}
void OnCameraMoved(object sender, EventArgs e)
{
}
}
class CustomMapCallbackHandler : Java.Lang.Object, Android.Gms.Maps.IOnMapReadyCallback
{
readonly CustomMapHandler handler;
public CustomMapCallbackHandler(CustomMapHandler handler)
{
this.handler = handler;
}
public void OnMapReady(Android.Gms.Maps.GoogleMap map)
{
this.handler.OnMapReady(map);
}
}Relevant Files
- src/Core/maps/src/Handlers/Map/MapHandler.cs
- src/Core/maps/src/Handlers/Map/MapHandler.Android.cs
- src/Controls/Maps/src/HandlerImpl/Map.Impl.cs
- src/Controls/Maps/src/Map.cs
Checklist
- Modify
src/Core/maps/src/Handlers/Map/MapHandler.Android.cs! No changes made Edit - Running GitHub Actions for
src/Core/maps/src/Handlers/Map/MapHandler.Android.cs✗ Edit - Modify
src/Core/maps/src/Handlers/Map/MapHandler.cs✓ 3d956e2 Edit - Running GitHub Actions for
src/Core/maps/src/Handlers/Map/MapHandler.cs✓ Edit - Modify
src/Controls/Maps/src/Map.cs! No changes made Edit - Running GitHub Actions for
src/Controls/Maps/src/Map.cs✗ Edit
Reactions are currently unavailable