Repository navigation
Convert NSColor/UIColor expressions to CSS color string values - #8025
Conversation
|
@1ec5, thanks for your PR! By analyzing this pull request, we identified @incanus, @jfirebaugh and @boundsj to be potential reviewers. |
| `halfway`. | ||
|
|
||
| The `MGLSymbolStyleLayer.textField` and `MGLSymbolStyleLayer.iconImageName` | ||
| properties use attributes in a slightly different way. For example, to label |
There was a problem hiding this comment.
It might be more accurate to say that these properties "can use attributes in a slightly different way", or "can also use attributes in a second way" -- because once #7944 goes in, the source-function-based approach described in the previous paragraph would also apply to these.
…values When converting a constant NSExpression to an mbgl::Value, turn an NSColor or UIColor into an std::string containing a CSS color string. This allows developers to set an attribute of an MGLFeature to an NSColor or UIColor (rather than a CSS color string, which would be foreign), then use it in an MGLStyleFunction with identity interpolation.
03cdf6a to
556afae
Compare
anandthakker
left a comment
There was a problem hiding this comment.
LGTM -- one comment inline, but not gonna hold up the Approve for that, since I'm not familiar with the docs overall.
| attribute to each of the source’s features, then set | ||
| `MGLCircleStyleLayer.circleRadius` to an `MGLStyleValue` object with an | ||
| interpolation mode of `MGLInterpolationModeIdentity` and an attribute name of | ||
| `halfway`. |
There was a problem hiding this comment.
Ack, this didn't occur to me earlier, but would this be a good place to suggest referring to the DDS support tables to for those properties where ^ this approach is actually available?
There was a problem hiding this comment.
MGLCircleStyleLayer.circleRadius will link automatically to the documentation for that property, which like all layout and paint properties will list the interpolation modes and function types that are supported. I would like to refer the developer to a guide on data-driven styling, once it’s written as part of #7924.
When converting a constant NSExpression to an
mbgl::Value, turn an NSColor or UIColor into anstd::stringcontaining a CSS color string. This allows developers to set an attribute of an MGLFeature to an NSColor or UIColor (rather than a CSS color string, which would be foreign), then use it in an MGLStyleFunction with identity interpolation.Along the way, I added language to
MGLFeature.attributes’ documentation to talk about the use of feature attributes in identity-interpolated style functions. I also simplified the NSExpression unit tests to more specifically test the category methods that convert constant NSExpressions tombgl::Values, without going through NSPredicate. Normally I’d be hesitant to rely so heavily on macros, which makes debugging more difficult, but the existing tests rely onforloops, which make test failures just as difficult to diagnose./cc @boundsj @jfirebaugh