[ios, macos] Deprecate -[MGLMapViewDelegate mapView:alphaForShapeAnnotation:] (#6706)
This commit is contained in:
@@ -51,6 +51,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
|
||||
* Improved the precision of annotations at zoom levels greater than 18. ([#5517](https://github.com/mapbox/mapbox-gl-native/pull/5517))
|
||||
* Fixed an issue that could reset user-added transformations on annotation views. ([#6166](https://github.com/mapbox/mapbox-gl-native/pull/6166))
|
||||
* Fixed an issue that caused an annotation view to disappear if it isn’t created using the annotation view reuse queue. ([#6485](https://github.com/mapbox/mapbox-gl-native/pull/6485))
|
||||
* Deprecated `-[MGLMapViewDelegate mapView:alphaForShapeAnnotation:]` in favor of specifying an alpha component via `-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:]` or `-[MGLMapViewDelegate mapView:fillColorForPolygonAnnotation:]`. ([#6706](https://github.com/mapbox/mapbox-gl-native/pull/6706))
|
||||
|
||||
### Networking and offline maps
|
||||
|
||||
|
||||
@@ -1123,11 +1123,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CGFloat)mapView:(__unused MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation
|
||||
{
|
||||
return ([annotation isKindOfClass:[MGLPolygon class]] ? 0.5 : 1.0);
|
||||
}
|
||||
|
||||
- (UIColor *)mapView:(__unused MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation
|
||||
{
|
||||
return ([annotation isKindOfClass:[MGLPolyline class]] ? [UIColor purpleColor] : [UIColor blackColor]);
|
||||
@@ -1135,7 +1130,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
|
||||
- (UIColor *)mapView:(__unused MGLMapView *)mapView fillColorForPolygonAnnotation:(__unused MGLPolygon *)annotation
|
||||
{
|
||||
return (annotation.pointCount > 3 ? [UIColor greenColor] : [UIColor redColor]);
|
||||
UIColor *color = annotation.pointCount > 3 ? [UIColor greenColor] : [UIColor redColor];
|
||||
return [color colorWithAlphaComponent:0.5];
|
||||
}
|
||||
|
||||
- (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(__unused BOOL)animated
|
||||
|
||||
@@ -3054,9 +3054,23 @@ public:
|
||||
|
||||
- (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;
|
||||
}
|
||||
|
||||
@@ -228,17 +228,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@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;
|
||||
- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation __attribute__((deprecated("Use -mapView:strokeColorForShapeAnnotation: or -mapView:fillColorForPolygonAnnotation:.")));
|
||||
|
||||
/**
|
||||
Returns the color to use when rendering the outline of a shape annotation.
|
||||
@@ -246,6 +236,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
The default stroke color is the map view’s tint color. If a pattern color is
|
||||
specified, the result is undefined.
|
||||
|
||||
Opacity may be set by specifying an alpha component. The default alpha value is
|
||||
`1.0` and results in a completely opaque stroke.
|
||||
|
||||
@param mapView The map view rendering the shape annotation.
|
||||
@param annotation The annotation being rendered.
|
||||
@return A color to use for the shape outline.
|
||||
@@ -258,6 +251,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
The default fill color is the map view’s tint color. If a pattern color is
|
||||
specified, the result is undefined.
|
||||
|
||||
Opacity may be set by specifying an alpha component. The default alpha value is
|
||||
`1.0` and results in a completely opaque shape.
|
||||
|
||||
@param mapView The map view rendering the polygon annotation.
|
||||
@param annotation The annotation being rendered.
|
||||
@return The polygon’s interior fill color.
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
* Database errors are now logged to the console. ([#6291](https://github.com/mapbox/mapbox-gl-native/pull/6291))
|
||||
* Improved style parsing performance. ([#6170](https://github.com/mapbox/mapbox-gl-native/pull/6170))
|
||||
* Fixed a typo in the documentation for the MGLCompassDirectionFormatter class. ([#5879](https://github.com/mapbox/mapbox-gl-native/pull/5879))
|
||||
* Deprecated `-[MGLMapViewDelegate mapView:alphaForShapeAnnotation:]` in favor of specifying an alpha component via `-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:]` or `-[MGLMapViewDelegate mapView:fillColorForPolygonAnnotation:]`. ([#6706](https://github.com/mapbox/mapbox-gl-native/pull/6706))
|
||||
|
||||
## 0.2.1 - July 19, 2016
|
||||
|
||||
|
||||
@@ -826,8 +826,9 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
|
||||
}
|
||||
}
|
||||
|
||||
- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation {
|
||||
return 0.8;
|
||||
- (NSColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation {
|
||||
NSColor *color = [[NSColor selectedMenuItemColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
|
||||
return [color colorWithAlphaComponent:0.8];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2163,8 +2163,18 @@ 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;
|
||||
}
|
||||
|
||||
@@ -156,17 +156,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation;
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@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;
|
||||
- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation __attribute__((deprecated("Use -mapView:strokeColorForShapeAnnotation: or -mapView:fillColorForPolygonAnnotation:.")));
|
||||
|
||||
/**
|
||||
Returns the color to use when rendering the outline of a shape annotation.
|
||||
@@ -174,6 +164,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
The default stroke color is the selected menu item color. If a pattern color is
|
||||
specified, the result is undefined.
|
||||
|
||||
Opacity may be set by specifying an alpha component. The default alpha value is
|
||||
`1.0` and results in a completely opaque stroke.
|
||||
|
||||
@param mapView The map view rendering the shape annotation.
|
||||
@param annotation The annotation being rendered.
|
||||
@return A color to use for the shape outline.
|
||||
@@ -186,6 +179,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
The default fill color is the selected menu item color. If a pattern color is
|
||||
specified, the result is undefined.
|
||||
|
||||
Opacity may be set by specifying an alpha component. The default alpha value is
|
||||
`1.0` and results in a completely opaque shape.
|
||||
|
||||
@param mapView The map view rendering the polygon annotation.
|
||||
@param annotation The annotation being rendered.
|
||||
@return The polygon’s interior fill color.
|
||||
|
||||
Reference in New Issue
Block a user