diff options
Diffstat (limited to 'platform/macos/app/MapDocument.m')
-rw-r--r-- | platform/macos/app/MapDocument.m | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index f30b83274a..81fd85e156 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -65,6 +65,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio BOOL _randomizesCursorsOnDroppedPins; BOOL _isTouringWorld; BOOL _isShowingPolygonAndPolylineAnnotations; + BOOL _isShowingAnimatedAnnotation; } #pragma mark Lifecycle @@ -329,9 +330,14 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } } +- (IBAction)showAllAnnotations:(id)sender { + [self.mapView showAnnotations:self.mapView.annotations animated:YES]; +} + - (IBAction)removeAllAnnotations:(id)sender { [self.mapView removeAnnotations:self.mapView.annotations]; _isShowingPolygonAndPolylineAnnotations = NO; + _isShowingAnimatedAnnotation = NO; } - (IBAction)startWorldTour:(id)sender { @@ -409,6 +415,8 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio DroppedPinAnnotation *annotation = [[DroppedPinAnnotation alloc] init]; [self.mapView addAnnotation:annotation]; + _isShowingAnimatedAnnotation = YES; + [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(updateAnimatedAnnotation:) @@ -632,10 +640,13 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (menuItem.action == @selector(dropManyPins:)) { return YES; } + if (menuItem.action == @selector(drawPolygonAndPolyLineAnnotations:)) { + return !_isShowingPolygonAndPolylineAnnotations; + } if (menuItem.action == @selector(drawAnimatedAnnotation:)) { - return YES; + return !_isShowingAnimatedAnnotation; } - if (menuItem.action == @selector(removeAllAnnotations:)) { + if (menuItem.action == @selector(showAllAnnotations:) || menuItem.action == @selector(removeAllAnnotations:)) { return self.mapView.annotations.count > 0; } if (menuItem.action == @selector(startWorldTour:)) { @@ -644,9 +655,6 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (menuItem.action == @selector(stopWorldTour:)) { return _isTouringWorld; } - if (menuItem.action == @selector(drawPolygonAndPolyLineAnnotations:)) { - return !_isShowingPolygonAndPolylineAnnotations; - } if (menuItem.action == @selector(addOfflinePack:)) { NSURL *styleURL = self.mapView.styleURL; return !styleURL.isFileURL; |