[ios,macos] Partially revert 06af75

Use static_cast<float> to convert from CGfloat when creating
PropertyValue<float> and avoid breaking backwards-compatibility.
This commit is contained in:
Bruno de Oliveira Abinader
2016-07-14 16:18:59 +03:00
parent 9ef30c2352
commit 44406e91de
7 changed files with 15 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol MGLMultiPointDelegate <NSObject>
/** Returns the fill alpha value for the given annotation. */
- (float)alphaForShapeAnnotation:(MGLShape *)annotation;
- (double)alphaForShapeAnnotation:(MGLShape *)annotation;
/** Returns the stroke color object for the given annotation. */
- (mbgl::Color)strokeColorForShapeAnnotation:(MGLShape *)annotation;
@@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
- (mbgl::Color)fillColorForPolygonAnnotation:(MGLPolygon *)annotation;
/** Returns the stroke width object for the given annotation. */
- (float)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
- (CGFloat)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
@end

View File

@@ -44,7 +44,7 @@
}
mbgl::FillAnnotation annotation { geometry };
annotation.opacity = { [delegate alphaForShapeAnnotation:self] };
annotation.opacity = { static_cast<float>([delegate alphaForShapeAnnotation:self]) };
annotation.outlineColor = { [delegate strokeColorForShapeAnnotation:self] };
annotation.color = { [delegate fillColorForPolygonAnnotation:self] };

View File

@@ -24,9 +24,9 @@
}
mbgl::LineAnnotation annotation { geometry };
annotation.opacity = { [delegate alphaForShapeAnnotation:self] };
annotation.opacity = { static_cast<float>([delegate alphaForShapeAnnotation:self]) };
annotation.color = { [delegate strokeColorForShapeAnnotation:self] };
annotation.width = { [delegate lineWidthForPolylineAnnotation:self] };
annotation.width = { static_cast<float>([delegate lineWidthForPolylineAnnotation:self]) };
return annotation;
}

View File

@@ -3033,13 +3033,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
return annotationContext.annotationView;
}
- (float)alphaForShapeAnnotation:(MGLShape *)annotation
- (double)alphaForShapeAnnotation:(MGLShape *)annotation
{
if (_delegateHasAlphasForShapeAnnotations)
{
return [self.delegate mapView:self alphaForShapeAnnotation:annotation];
}
return 1.0f;
return 1.0;
}
- (mbgl::Color)strokeColorForShapeAnnotation:(MGLShape *)annotation
@@ -3058,13 +3058,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
return MGLColorObjectFromUIColor(color);
}
- (float)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation
- (CGFloat)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation
{
if (_delegateHasLineWidthsForShapeAnnotations)
{
return [self.delegate mapView:self lineWidthForPolylineAnnotation:(MGLPolyline *)annotation];
}
return 3.0f;
return 3.0;
}
- (void)installAnnotationImage:(MGLAnnotationImage *)annotationImage

View File

@@ -247,7 +247,7 @@ NS_ASSUME_NONNULL_BEGIN
@param annotation The annotation being rendered.
@return A line width for the polyline, measured in points.
*/
- (float)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
- (CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
#pragma mark Managing Annotation Views

View File

@@ -2097,11 +2097,11 @@ public:
#pragma mark MGLMultiPointDelegate methods
- (float)alphaForShapeAnnotation:(MGLShape *)annotation {
- (double)alphaForShapeAnnotation:(MGLShape *)annotation {
if (_delegateHasAlphasForShapeAnnotations) {
return [self.delegate mapView:self alphaForShapeAnnotation:annotation];
}
return 1.0f;
return 1.0;
}
- (mbgl::Color)strokeColorForShapeAnnotation:(MGLShape *)annotation {
@@ -2118,11 +2118,11 @@ public:
return MGLColorObjectFromNSColor(color);
}
- (float)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation {
- (CGFloat)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation {
if (_delegateHasLineWidthsForShapeAnnotations) {
return [self.delegate mapView:self lineWidthForPolylineAnnotation:(MGLPolyline *)annotation];
}
return 3.0f;
return 3.0;
}
#pragma mark MGLPopoverDelegate methods

View File

@@ -174,7 +174,7 @@ NS_ASSUME_NONNULL_BEGIN
@param annotation The annotation being rendered.
@return A line width for the polyline, measured in points.
*/
- (float)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
- (CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
#pragma mark Selecting Annotations