[ios] MGLAnnotationView annotation property made writable (#8139)

This commit is contained in:
Fabian Guerra Soto
2017-03-02 18:19:23 -05:00
committed by GitHub
parent e1c85e8ec3
commit 8a5cc3560a
4 changed files with 3 additions and 3 deletions

View File

@@ -89,7 +89,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
contains a non-`nil` value while the annotation view is visible on the map. If
the view is queued, waiting to be reused, the value is `nil`.
*/
@property (nonatomic, readonly, nullable) id <MGLAnnotation> annotation;
@property (nonatomic, nullable) id <MGLAnnotation> annotation;
/**
The string that identifies that this annotation view is reusable.

View File

@@ -10,7 +10,6 @@
@interface MGLAnnotationView () <UIGestureRecognizerDelegate>
@property (nonatomic, readwrite, nullable) NSString *reuseIdentifier;
@property (nonatomic, readwrite, nullable) id <MGLAnnotation> annotation;
@property (nonatomic, readwrite) CATransform3D lastAppliedScaleTransform;
@property (nonatomic, weak) UIPanGestureRecognizer *panGestureRecognizer;
@property (nonatomic, weak) UILongPressGestureRecognizer *longPressRecognizer;
@@ -240,6 +239,7 @@
}
else if (dragState == MGLAnnotationViewDragStateCanceling)
{
NSAssert(self.annotation, @"Annotation property should not be nil.");
self.panGestureRecognizer.enabled = NO;
self.longPressRecognizer.enabled = NO;
self.center = [self.mapView convertCoordinate:self.annotation.coordinate toPointToView:self.mapView];

View File

@@ -8,7 +8,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface MGLAnnotationView (Private)
@property (nonatomic, readwrite, nullable) NSString *reuseIdentifier;
@property (nonatomic, readwrite, nullable) id <MGLAnnotation> annotation;
@property (nonatomic, weak) MGLMapView *mapView;
@end

View File

@@ -1516,6 +1516,7 @@ public:
{
if (view.centerOffset.dx != 0 || view.centerOffset.dy != 0) {
if (CGRectContainsPoint(view.frame, tapPoint)) {
NSAssert(view.annotation, @"Annotation's view annotation property should not be nil.");
CGPoint annotationPoint = [self convertCoordinate:view.annotation.coordinate toPointToView:self];
tapPoint = annotationPoint;
}