You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
In the iOS SDK - (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id<MGLAnnotation>)annotation is called whenever the user pans or zooms the MGLMapView. It would be great to have a way to prevent annotation deselection when panning or zooming the MGLMapView.
In the project I am currently working on we swap out the annotation image when an annotation is selected (we do not show a callout) to indicate the selected state of the annotation and would like to retain that selection state when the user pans/zooms the map. We are currently working around the issue by keeping track of the selected annotation in our own property and we ignore the deselection callback. The disadvantage to this approach is that we have no way of deselecting our annotation when a user taps outside of the annotation since the deselection callback does not allow us differentiate between a deselection due to a pan/zoom vs deselection due to a tap outside of the currently selected annotation.
I realize this has implications to how callout functionality would work as you would want the callout to dismiss when the user pans/zooms even if you do want the annotation to remain selected in that case. Since the callout state and the selection state are coupled, decoupling the callout may be necessary in order to implement this feature properly.
The text was updated successfully, but these errors were encountered:
Once #3154 is fixed, that method won’t get called as soon as the user pans or zooms the map. Your approach to tracking selection – with a property on a custom subclass of MGLPointAnnotation – would be a good approach in general.
In the iOS SDK
- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id<MGLAnnotation>)annotation
is called whenever the user pans or zooms the MGLMapView. It would be great to have a way to prevent annotation deselection when panning or zooming the MGLMapView.In the project I am currently working on we swap out the annotation image when an annotation is selected (we do not show a callout) to indicate the selected state of the annotation and would like to retain that selection state when the user pans/zooms the map. We are currently working around the issue by keeping track of the selected annotation in our own property and we ignore the deselection callback. The disadvantage to this approach is that we have no way of deselecting our annotation when a user taps outside of the annotation since the deselection callback does not allow us differentiate between a deselection due to a pan/zoom vs deselection due to a tap outside of the currently selected annotation.
I realize this has implications to how callout functionality would work as you would want the callout to dismiss when the user pans/zooms even if you do want the annotation to remain selected in that case. Since the callout state and the selection state are coupled, decoupling the callout may be necessary in order to implement this feature properly.
The text was updated successfully, but these errors were encountered: