summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLStyle.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLStyle.mm')
-rw-r--r--platform/darwin/src/MGLStyle.mm26
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 1e0a2e02b7..8c72c19e42 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -743,6 +743,32 @@ static NSURL *MGLStyleURL_emerald;
self.localizedLayersByIdentifier = [NSMutableDictionary dictionary];
}
+ [self setPreferredContentSize:nil];
+}
+
+- (void)setPreferredContentSize:(UIContentSizeCategory)preferredContentSize
+{
+ for (MGLSymbolStyleLayer *layer in self.layers) {
+ if (![layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
+ continue;
+ }
+
+ MGLVectorSource *source = (MGLVectorSource *)[self sourceWithIdentifier:layer.sourceIdentifier];
+ if (![source isKindOfClass:[MGLVectorSource class]] || !source.mapboxStreets) {
+ continue;
+ }
+
+ if ([layer.textFontSize isKindOfClass:[MGLConstantStyleValue class]]) {
+ NSNumber *textFontSize = [(MGLConstantStyleValue<NSNumber *> *)layer.textFontSize rawValue];
+ textFontSize = [NSNumber numberWithFloat:(textFontSize.floatValue * [self sizeForContentSizeCategory:preferredContentSize])];
+ layer.textFontSize = [MGLStyleValue<NSNumber *> valueWithRawValue:textFontSize];
+ }
+ }
+}
+
+- (CGFloat)sizeForContentSizeCategory:(UIContentSizeCategory)preferredContentSize
+{
+ return 1.3;
}
@end