Open mfeingol opened 1 year ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
This is still an issue in .NET 8
I believe the reason this doesn't work is this line:
public static void MapLocation(IMapPinHandler handler, IMapPin mapPin)
{
if (mapPin.Location != null)
handler.PlatformView.SetPosition(new LatLng(mapPin.Location.Latitude, mapPin.Location.Longitude));
}
The handler maintains a MarkerOptions as its PlatformView and loses track of the Marker instance created in the MapHandler. So updating the Pin's Location property updates the MarkerOptions, which has already been used to create the Marker and is therefore no longer useful. The handler should keep track of the created Marker (which is present in a private list on the MapHandler) and update its Position property directly.
@mfeingol thanks for the investigation here! Would you also maybe be able to provide a PR? Or is that not something you would want to help out with? 😄
Description
Changing the Location property on a Microsoft.Maui.Controls.Maps.Pin does not change the location of the Pin on the map.
Steps to Reproduce
pin. Location = something;
Link to public reproduction project repository
Shouldn't be needed
Version with bug
7.0 (current)
Last version that worked well
7.0 (current)
Affected platforms
Android
Affected platform versions
Android 13
Did you find any workaround?
Removing the pin and re-adding it works. This is annoying and code that updates a pin's location needs to be changed everywhere when porting from Xamarin.Forms.Maps
Relevant log output
No response