-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Don't deselect annotations on pan/zoom, even if the annotation moves out of the visible bounds #8022
Conversation
4bd3886
to
28ae886
Compare
Thanks for this PR. Based on #8021 (comment), I think we could get away with a fix that doesn’t add any additional options to the API, but I’m curious whether that would address your use case. |
28ae886
to
0fb4c3e
Compare
platform/ios/src/MGLMapView.mm
Outdated
@@ -4729,7 +4736,7 @@ - (void)notifyMapChange:(mbgl::MapChange)change | |||
rect = annotationView.frame; | |||
} | |||
|
|||
if ( ! CGRectIntersectsRect(rect, self.frame)) { | |||
if ( ! CGRectIntersectsRect(rect, self.frame) && self.deselectWhenOutOfBounds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced this property is needed. I would prefer to just remove these lines unless I can see a use case where deselect when out of bounds should be the default behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to remove this, I just added it because I thought that @1ec5 was not fine with removing the current way how deselection is handled completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given #8021 (comment), I’ve changed my mind; if MapKit and Google Maps avoid deselecting the annotation, then that’s what developers expect, and an extra option is unnecessary.
Are there any implications for callout views? Does any of the callout code assume that a callout view (if it exists) is always visible as long as its annotation is selected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I have updated my PR to that annotations are not deselected any longer. If the annotation has a callout view which responds to dismissAutomatically
, the annotation is deselected if that function returns true
.
0fb4c3e
to
27838ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Would you do the honors and update the iOS changelog to mention this change?
…d or annotation is moved out of the visible bounds
27838ff
to
a78b784
Compare
Happy to do that. Done ;-) |
This fixes #8021
Don't deselect annotations on pan/zoom, even if the annotation moves out of the visible bounds. Now MapBox behaves like Google Maps and MapKit.