An offset style attribute is now exposed publicly as an NSValue representing a CGVector instead of an NSArray of NSNumbers. A padding style attribute is now exposed publicly as an NSValue representing an NSEdgeInsets or UIEdgeInsets instead of an NSArray of NSNumbers. This change also fixes round-tripping of padding values due to a difference between the style specification and Foundation regarding the order of edges around a box. Used a designated initializer on NSEdgeInsets/UIEdgeInsets to ensure correct order when converting from C++ to Objective-C. Fixes #5947, fixes #6065.
37 lines
768 B
Plaintext
37 lines
768 B
Plaintext
#import "NSArray+MGLStyleAttributeAdditions.h"
|
|
|
|
#import "NSArray+MGLStyleAttributeAdditions_Private.h"
|
|
#import "MGLStyleAttributeValue_Private.h"
|
|
|
|
#include <array>
|
|
|
|
@interface NSArray(Private) <MGLStyleAttributeValue_Private>
|
|
@end
|
|
|
|
@implementation NSArray (MGLStyleAttributeAdditions)
|
|
|
|
- (mbgl::style::PropertyValue<std::vector<std::string> >)mbgl_stringArrayPropertyValue
|
|
{
|
|
std::vector<std::string>fonts;
|
|
|
|
for (NSString *font in self) {
|
|
fonts.emplace_back(font.UTF8String);
|
|
}
|
|
|
|
return {{fonts}};
|
|
}
|
|
|
|
- (mbgl::style::PropertyValue<std::vector<float> >)mbgl_numberArrayPropertyValue
|
|
{
|
|
std::vector<float>values;
|
|
|
|
for (NSNumber *n in self) {
|
|
values.emplace_back(n.floatValue);
|
|
}
|
|
|
|
return {{values}};
|
|
}
|
|
|
|
|
|
@end
|