diff options
author | Randall Lee <randall.lee@mapbox.com> | 2018-05-22 14:09:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 14:09:36 -0400 |
commit | d858cb783b499a1cc77b48a0faee137ca5e6a423 (patch) | |
tree | 5c36c353730e3050d44e472545519c0429723266 /platform/macos/src | |
parent | f93d722458be62d567aa152711a014ef51a90193 (diff) | |
parent | 60505b03174b5ec02ae723beafa7683f6ed54a62 (diff) | |
download | qtlocation-mapboxgl-upstream/rclee-async-setup.tar.gz |
Merge branch 'master' into rclee-async-setupupstream/rclee-async-setup
Diffstat (limited to 'platform/macos/src')
-rw-r--r-- | platform/macos/src/MGLMapView+IBAdditions.mm | 14 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.h | 34 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 52 | ||||
-rw-r--r-- | platform/macos/src/Mapbox.h | 1 | ||||
-rw-r--r-- | platform/macos/src/NSColor+MGLAdditions.mm | 10 |
5 files changed, 59 insertions, 52 deletions
diff --git a/platform/macos/src/MGLMapView+IBAdditions.mm b/platform/macos/src/MGLMapView+IBAdditions.mm index eada47ef90..cef2863ee6 100644 --- a/platform/macos/src/MGLMapView+IBAdditions.mm +++ b/platform/macos/src/MGLMapView+IBAdditions.mm @@ -4,7 +4,7 @@ @implementation MGLMapView (IBAdditions) -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyleURL__ { return [NSSet setWithObject:@"styleURL"]; } @@ -23,7 +23,7 @@ self.styleURL = url; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingLatitude { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingLatitude { return [NSSet setWithObjects:@"centerCoordinate", @"camera", nil]; } @@ -45,7 +45,7 @@ } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingLongitude { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingLongitude { return [NSSet setWithObjects:@"centerCoordinate", @"camera", nil]; } @@ -67,7 +67,7 @@ } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsZooming { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsZooming { return [NSSet setWithObject:@"zoomEnabled"]; } @@ -79,7 +79,7 @@ self.zoomEnabled = allowsZooming; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsScrolling { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsScrolling { return [NSSet setWithObject:@"scrollEnabled"]; } @@ -91,7 +91,7 @@ self.scrollEnabled = allowsScrolling; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsRotating { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsRotating { return [NSSet setWithObject:@"rotateEnabled"]; } @@ -103,7 +103,7 @@ self.rotateEnabled = allowsRotating; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsTilting { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsTilting { return [NSSet setWithObject:@"pitchEnabled"]; } diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h index e3de1069a9..824df827ac 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -443,7 +443,7 @@ MGL_EXPORT IB_DESIGNABLE @param animated `YES` if you want the map region change to be animated, or `NO` if you want the map to display the new region immediately without animations. */ -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated; +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated; /** Sets the visible region so that the map displays the specified annotations with @@ -458,7 +458,7 @@ MGL_EXPORT IB_DESIGNABLE @param animated `YES` if you want the map region change to be animated, or `NO` if you want the map to display the new region immediately without animations. */ -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated; +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated; /** Returns the camera that best fits the given coordinate bounds. @@ -621,7 +621,7 @@ MGL_EXPORT IB_DESIGNABLE annotations are associated with the map view, the value of this property is `nil`. */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *annotations; +@property (nonatomic, readonly, nullable) NSArray<id <MGLAnnotation>> *annotations; /** Adds an annotation to the map view. @@ -651,7 +651,7 @@ MGL_EXPORT IB_DESIGNABLE must conform to the `MGLAnnotation` protocol. The map view retains each individual annotation object. */ -- (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations; +- (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations; /** The complete list of annotations associated with the receiver that are @@ -661,7 +661,7 @@ MGL_EXPORT IB_DESIGNABLE annotations are associated with the map view or if no annotations associated with the map view are currently visible, the value of this property is `nil`. */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *visibleAnnotations; +@property (nonatomic, readonly, nullable) NSArray<id <MGLAnnotation>> *visibleAnnotations; /** Removes an annotation from the map view, deselecting it if it is selected. @@ -686,7 +686,7 @@ MGL_EXPORT IB_DESIGNABLE @param annotations The array of annotation objects to remove. Objects in the array must conform to the `MGLAnnotation` protocol. */ -- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations; +- (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations; /** Returns a reusable annotation image object associated with its identifier. @@ -712,7 +712,7 @@ MGL_EXPORT IB_DESIGNABLE no annotations associated with the map view are currently visible in the rectangle. */ -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect; +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect; #pragma mark Managing Annotation Selections @@ -729,7 +729,7 @@ MGL_EXPORT IB_DESIGNABLE @note In versions prior to `4.0.0` if the annotation was offscreen it was not selected. */ -@property (nonatomic, copy) NS_ARRAY_OF(id <MGLAnnotation>) *selectedAnnotations; +@property (nonatomic, copy) NSArray<id <MGLAnnotation>> *selectedAnnotations; /** Selects an annotation and displays a callout popover for it. @@ -791,7 +791,7 @@ MGL_EXPORT IB_DESIGNABLE overlays are associated with the map view, the value of this property is empty array. */ -@property (nonatomic, readonly, nonnull) NS_ARRAY_OF(id <MGLOverlay>) *overlays; +@property (nonatomic, readonly, nonnull) NSArray<id <MGLOverlay>> *overlays; /** Adds a single overlay to the map. @@ -811,7 +811,7 @@ MGL_EXPORT IB_DESIGNABLE @param overlays An array of objects, each of which must conform to the `MGLOverlay` protocol. */ -- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays; +- (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays; /** Removes a single overlay from the map. @@ -831,7 +831,7 @@ MGL_EXPORT IB_DESIGNABLE @param overlays An array of objects, each of which conforms to the `MGLOverlay` protocol. */ -- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays; +- (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays; #pragma mark Accessing the Underlying Map Data @@ -847,7 +847,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point NS_SWIFT_NAME(visibleFeatures(at:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point NS_SWIFT_NAME(visibleFeatures(at:)); /** Returns an array of rendered map features that intersect with a given point, @@ -866,7 +866,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); /** Returns an array of rendered map features that intersect with a given point, @@ -928,7 +928,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:)); /** Returns an array of rendered map features that intersect with the given @@ -943,7 +943,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect NS_SWIFT_NAME(visibleFeatures(in:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect NS_SWIFT_NAME(visibleFeatures(in:)); /** Returns an array of rendered map features that intersect with the given @@ -962,7 +962,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); /** Returns an array of rendered map features that intersect with the given @@ -1026,7 +1026,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:)); #pragma mark Converting Geographic Coordinates diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 9a9e19c363..bc9ac1e641 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -58,7 +58,7 @@ #import "NSURL+MGLAdditions.h" #import "NSColor+MGLAdditions.h" #import "NSImage+MGLAdditions.h" -#import "NSPredicate+MGLAdditions.h" +#import "NSPredicate+MGLPrivateAdditions.h" #import <QuartzCore/QuartzCore.h> #import <OpenGL/gl.h> @@ -149,7 +149,7 @@ public: @property (nonatomic, readwrite) MGLStyle *style; /// Mapping from reusable identifiers to annotation images. -@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLAnnotationImage *) *annotationImagesByIdentifier; +@property (nonatomic) NSMutableDictionary<NSString *, MGLAnnotationImage *> *annotationImagesByIdentifier; /// Currently shown popover representing the selected annotation. @property (nonatomic) NSPopover *calloutForSelectedAnnotation; @@ -611,7 +611,7 @@ public: #pragma mark Style -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyle { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyle { return [NSSet setWithObject:@"styleURL"]; } @@ -965,7 +965,7 @@ public: #pragma mark Viewport -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCenterCoordinate { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCenterCoordinate { return [NSSet setWithObjects:@"latitude", @"longitude", @"camera", nil]; } @@ -1015,7 +1015,7 @@ public: _pendingLongitude = pendingLongitude; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingZoomLevel { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingZoomLevel { return [NSSet setWithObject:@"camera"]; } @@ -1083,7 +1083,7 @@ public: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingDirection { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingDirection { return [NSSet setWithObject:@"camera"]; } @@ -1107,7 +1107,7 @@ public: [self setDirection:_mbglMap->getBearing() + delta animated:animated]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCamera { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCamera { return [NSSet setWithObjects:@"latitude", @"longitude", @"centerCoordinate", @"zoomLevel", @"direction", nil]; } @@ -1765,7 +1765,7 @@ public: #pragma mark Annotations -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)annotations { +- (nullable NSArray<id <MGLAnnotation>> *)annotations { if (_annotationContextsByAnnotationTag.empty()) { return nil; } @@ -1781,12 +1781,12 @@ public: return [NSArray arrayWithObjects:&annotations[0] count:annotations.size()]; } -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotations +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotations { return [self visibleFeaturesInRect:self.bounds]; } -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect { if (_annotationContextsByAnnotationTag.empty()) { @@ -1852,7 +1852,7 @@ public: } } -- (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations { +- (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { if (!annotations) { return; } @@ -1987,7 +1987,7 @@ public: } } -- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations { +- (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { if (!annotations) { return; } @@ -2192,12 +2192,12 @@ public: [self didChangeValueForKey:@"selectedAnnotations"]; } -- (NS_ARRAY_OF(id <MGLAnnotation>) *)selectedAnnotations { +- (NSArray<id <MGLAnnotation>> *)selectedAnnotations { id <MGLAnnotation> selectedAnnotation = self.selectedAnnotation; return selectedAnnotation ? @[selectedAnnotation] : @[]; } -- (void)setSelectedAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)selectedAnnotations { +- (void)setSelectedAnnotations:(NSArray<id <MGLAnnotation>> *)selectedAnnotations { if (!selectedAnnotations.count) { return; } @@ -2338,7 +2338,7 @@ public: } } -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated { +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated { CGFloat maximumPadding = 100; CGFloat yPadding = (NSHeight(self.bounds) / 5 <= maximumPadding) ? (NSHeight(self.bounds) / 5) : maximumPadding; CGFloat xPadding = (NSWidth(self.bounds) / 5 <= maximumPadding) ? (NSWidth(self.bounds) / 5) : maximumPadding; @@ -2348,7 +2348,7 @@ public: [self showAnnotations:annotations edgePadding:edgeInsets animated:animated]; } -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated { +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated { if ( ! annotations || ! annotations.count) return; mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); @@ -2547,11 +2547,11 @@ public: #pragma mark Overlays -- (nonnull NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (nonnull NSArray<id <MGLOverlay>> *)overlays { if (self.annotations == nil) { return @[]; } - NS_MUTABLE_ARRAY_OF(id <MGLOverlay>) *mutableOverlays = [NSMutableArray array]; + NSMutableArray<id <MGLOverlay>> *mutableOverlays = [NSMutableArray array]; [self.annotations enumerateObjectsUsingBlock:^(id<MGLAnnotation> _Nonnull annotation, NSUInteger idx, BOOL * _Nonnull stop) { if ([annotation conformsToProtocol:@protocol(MGLOverlay)]) @@ -2567,7 +2567,7 @@ public: [self addOverlays:@[overlay]]; } -- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays { #if DEBUG for (id <MGLOverlay> overlay in overlays) { @@ -2581,7 +2581,7 @@ public: [self removeOverlays:@[overlay]]; } -- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays { +- (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays { #if DEBUG for (id <MGLOverlay> overlay in overlays) { NSAssert([overlay conformsToProtocol:@protocol(MGLOverlay)], @"Overlay does not conform to MGLOverlay"); @@ -2662,15 +2662,15 @@ public: #pragma mark Data -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point { return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { // Cocoa origin is at the lower-left corner. mbgl::ScreenCoordinate screenCoordinate = { point.x, NSHeight(self.bounds) - point.y }; @@ -2693,15 +2693,15 @@ public: return MGLFeaturesFromMBGLFeatures(features); } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect { return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { // Cocoa origin is at the lower-left corner. mbgl::ScreenBox screenBox = { { NSMinX(rect), NSHeight(self.bounds) - NSMaxY(rect) }, diff --git a/platform/macos/src/Mapbox.h b/platform/macos/src/Mapbox.h index fcf41203cf..198998a874 100644 --- a/platform/macos/src/Mapbox.h +++ b/platform/macos/src/Mapbox.h @@ -62,3 +62,4 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[]; #import "MGLAttributionInfo.h" #import "MGLMapSnapshotter.h" #import "NSExpression+MGLAdditions.h" +#import "NSPredicate+MGLAdditions.h" diff --git a/platform/macos/src/NSColor+MGLAdditions.mm b/platform/macos/src/NSColor+MGLAdditions.mm index 8c9086ccf7..c73c1a41b7 100644 --- a/platform/macos/src/NSColor+MGLAdditions.mm +++ b/platform/macos/src/NSColor+MGLAdditions.mm @@ -79,8 +79,14 @@ components.push_back(component.doubleValue / 255.0); } - // Alpha - components.back() *= 255.0; + + if (components.size() < 4) { + components.push_back(1.0); + } else { + // Alpha + components.back() *= 255.0; + } + // macOS 10.12 Sierra and below uses calibrated RGB by default. if ([NSColor redColor].colorSpaceName == NSCalibratedRGBColorSpace) { |