diff options
author | Jason Wray <jason@mapbox.com> | 2017-01-12 21:37:21 -0500 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2017-01-13 15:43:41 -0500 |
commit | 8f6009ea20dd74e39054c005d0e226ee07a3f168 (patch) | |
tree | 1e0118b8d045d72d9f5d0942e65ccee32d8d026a /platform/macos/src | |
parent | 4d5036616f85ff87ffe9042739872b1a080015b2 (diff) | |
download | qtlocation-mapboxgl-8f6009ea20dd74e39054c005d0e226ee07a3f168.tar.gz |
[ios, macos] Revert deprecation of alphaForShapeAnnotation: delegate method
Diffstat (limited to 'platform/macos/src')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 10 | ||||
-rw-r--r-- | platform/macos/src/MGLMapViewDelegate.h | 17 |
2 files changed, 16 insertions, 11 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 9ed399c789..7bd8f3369e 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -2273,18 +2273,8 @@ public: #pragma mark MGLMultiPointDelegate methods - (double)alphaForShapeAnnotation:(MGLShape *)annotation { - // The explicit -mapView:alphaForShapeAnnotation: delegate method is deprecated - // but still used, if implemented. When not implemented, call the stroke or - // fill color delegate methods and pull the alpha from the returned color. if (_delegateHasAlphasForShapeAnnotations) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" return [self.delegate mapView:self alphaForShapeAnnotation:annotation]; -#pragma clang diagnostic pop - } else if ([annotation isKindOfClass:[MGLPolygon class]]) { - return [self fillColorForPolygonAnnotation:(MGLPolygon *)annotation].a ?: 1.0; - } else if ([annotation isKindOfClass:[MGLShape class]]) { - return [self strokeColorForShapeAnnotation:annotation].a ?: 1.0; } return 1.0; } diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h index e07378bf16..1cf86263f3 100644 --- a/platform/macos/src/MGLMapViewDelegate.h +++ b/platform/macos/src/MGLMapViewDelegate.h @@ -156,7 +156,22 @@ NS_ASSUME_NONNULL_BEGIN */ - (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation; -- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation __attribute__((deprecated("Use -mapView:strokeColorForShapeAnnotation: or -mapView:fillColorForPolygonAnnotation:."))); +/** + Returns the alpha value to use when rendering a shape annotation. + + A value of 0.0 results in a completely transparent shape. A value of 1.0, the + default, results in a completely opaque shape. + + This method sets the opacity of an entire shape, inclusive of its stroke and + fill. To independently set the values for stroke or fill, specify an alpha + component in the color returned by `-mapView:strokeColorForShapeAnnotation:` or + `-mapView:fillColorForPolygonAnnotation:`. + + @param mapView The map view rendering the shape annotation. + @param annotation The annotation being rendered. + @return An alpha value between 0 and 1.0. + */ +- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation; /** Returns the color to use when rendering the outline of a shape annotation. |