This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] fixes #5128 selected property to MGLAnnotationView #5283
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,16 @@ - (void)setCenterOffset:(CGVector)centerOffset | |
self.center = self.center; | ||
} | ||
|
||
- (void)setSelected:(BOOL)selected | ||
{ | ||
[self setSelected:selected animated:NO]; | ||
} | ||
|
||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated | ||
{ | ||
_selected = selected; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In order to be KVO-compliant, we need to bracket this line with calls to |
||
} | ||
|
||
- (void)setCenter:(CGPoint)center | ||
{ | ||
[self setCenter:center pitch:0]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3376,7 +3376,7 @@ - (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated | |
self.userTrackingMode = MGLUserTrackingModeNone; | ||
} | ||
|
||
[self deselectAnnotation:self.selectedAnnotation animated:NO]; | ||
[self deselectAnnotation:self.selectedAnnotation animated:animated]; | ||
|
||
// Add the annotation to the map if it hasn’t been added yet. | ||
MGLAnnotationTag annotationTag = [self annotationTagForAnnotation:annotation]; | ||
|
@@ -3401,6 +3401,8 @@ - (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated | |
positioningRect = annotationView.frame; | ||
|
||
[annotationView.superview bringSubviewToFront:annotationView]; | ||
|
||
[annotationView setSelected:YES animated:animated]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
} | ||
|
||
|
@@ -3554,6 +3556,19 @@ - (void)deselectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animate | |
{ | ||
// dismiss popup | ||
[self.calloutViewForSelectedAnnotation dismissCalloutAnimated:animated]; | ||
|
||
// deselect annotation view | ||
MGLAnnotationTag annotationTag = [self annotationTagForAnnotation:annotation]; | ||
if (annotationTag != MGLAnnotationTagNotFound) | ||
{ | ||
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); | ||
MGLAnnotationView *annotationView = annotationContext.annotationView; | ||
|
||
if (annotationView) | ||
{ | ||
[annotationView setSelected:NO animated:animated]; | ||
} | ||
} | ||
|
||
// clean up | ||
self.calloutViewForSelectedAnnotation = nil; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
On iOS, we say "tap" instead of "click".