summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLAttributedExpression.m
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2019-03-19 14:53:35 -0700
committerGitHub <noreply@github.com>2019-03-19 14:53:35 -0700
commit174c8fa7e4927ebf28a3d0e07c995d3e3d69de76 (patch)
treef503bdf15e24f9c744f634107fc04c6338d1c42d /platform/darwin/src/MGLAttributedExpression.m
parent10e1e63aee95f579f951e3c2001640a268d3d95c (diff)
downloadqtlocation-mapboxgl-174c8fa7e4927ebf28a3d0e07c995d3e3d69de76.tar.gz
[ios, macos] Add text-color support to format expressions. (#14146)
Added the possibility of overriding paint properties inside the format expression. Added an example of how to create an MGLAttributedExpression object and documented the attributes keys and value types. Fixed a bug that ignored the font names.
Diffstat (limited to 'platform/darwin/src/MGLAttributedExpression.m')
-rw-r--r--platform/darwin/src/MGLAttributedExpression.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLAttributedExpression.m b/platform/darwin/src/MGLAttributedExpression.m
index 715f74e42f..000701f7cf 100644
--- a/platform/darwin/src/MGLAttributedExpression.m
+++ b/platform/darwin/src/MGLAttributedExpression.m
@@ -3,11 +3,12 @@
const MGLAttributedExpressionKey MGLFontNamesAttribute = @"text-font";
const MGLAttributedExpressionKey MGLFontSizeAttribute = @"font-scale";
+const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color";
@implementation MGLAttributedExpression
- (instancetype)initWithExpression:(NSExpression *)expression {
- self = [self initWithExpression:expression attributes:nil];
+ self = [self initWithExpression:expression attributes:@{}];
return self;
}
@@ -28,7 +29,15 @@ const MGLAttributedExpressionKey MGLFontSizeAttribute = @"font-scale";
return attributedExpression;
}
-- (instancetype)initWithExpression:(NSExpression *)expression attributes:(NSDictionary<MGLAttributedExpressionKey,id> *)attrs {
++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey,id> *)attrs {
+ MGLAttributedExpression *attributedExpression;
+
+ attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs];
+
+ return attributedExpression;
+}
+
+- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey,id> *)attrs {
if (self = [super init])
{
MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class]));