Repository navigation
Add data-driven-styling support for text-font - #10850
Conversation
| global.propertyDefault = function (property, layerType) { | ||
| return 'an `MGLStyleValue` object containing ' + describeValue(property.default, property, layerType); | ||
| if (property.name === 'heatmap-color') { | ||
| return 'a rainbow color scale from blue to red'; |
|
|
||
| /** | ||
| Controls the translation reference point. | ||
| Controls the frame of reference for `fillExtrusionTranslate`. |
There was a problem hiding this comment.
This is unfortunate, because the iOS/macOS SDKs rename fillExtrusionTranslate to fillExtrusionTranslation etc.
|
|
||
| This property corresponds to the `raster-fade-duration-transition` property in the style JSON file format. | ||
| */ | ||
| @property (nonatomic) MGLTransition rasterFadeDurationTransition; |
There was a problem hiding this comment.
Is the removal of this property intentional? It’s is present in iOS map SDK v3.7.0, so typically we’d deprecate it before removing it outright.
There was a problem hiding this comment.
Yes, see mapbox/mapbox-gl-js@fa47208. I'd advocate for outright removing it rather than deprecating: it's very obscure, and this is for a semver major release anyway.
There was a problem hiding this comment.
Makes sense. I guess in the future we can also subsume raster-fade-duration under a transition property somehow for consistency.
| like {field_name}. (Token replacement is only supported for literal | ||
| `textField` values--not for property functions.) | ||
| like `{field_name}`. (`{token}` replacement is only supported for literal | ||
| `textField` values; not for property functions.) |
There was a problem hiding this comment.
Note that this implies support for {token} replacement in expressions. (Also, in the event that someone happens to update this documentation in the style specification, the semicolon should be a comma.)
There was a problem hiding this comment.
mapbox/mapbox-gl-js#5959 mentions data expressions and fixes the typo.
There was a problem hiding this comment.
I think we should just remove references to token replacement entirely. We want people to migrate to expressions (and we're not going to support token replacement within them: #10399).
There was a problem hiding this comment.
The published style specification is the canonical documentation for runtime styling for both GL JS (which supports expressions) and Android (which doesn’t yet in v5.3.0). @tobrun, do you think it would be safe to remove the bit about the {token} syntax now, before the next Android release which has expression support?
| /** | ||
| Offset distance of icon from its anchor. | ||
|
|
||
| This property is measured in points multiplied by the value of "icon-size"s. |
There was a problem hiding this comment.
generate-style-code assumes units is a single plural word. The style specification should use backticks instead of double quotation marks around icon-size, and propertyDoc() should account for this case by not tacking an “s” onto the end.
There was a problem hiding this comment.
mapbox/mapbox-gl-js#5959 changes the quotation marks to backticks.
| `NSValue` object containing a `CGVector` struct set to 0 rightward and 0 | ||
| downward. Set this property to `nil` to reset it to the default value. | ||
| `NSValue` object containing a `CGVector` struct set to 0 points multiplied by | ||
| the value of "icon-size"s rightward and 0 points multiplied by the value of |
There was a problem hiding this comment.
This is why sticking a phrase inside units is problematic. I guess we can special-case this property to omit the unit (even though CGVector normally specifies two point values).
There was a problem hiding this comment.
👍 I'm going to revert mapbox/mapbox-gl-js@67bce60 and explain this in the prose instead.
There was a problem hiding this comment.
OK. For what it’s worth, 5374da2 adds support for resolving property references in backticks and also omits unwieldy units from struct descriptions. No harm in merging mapbox/mapbox-gl-js#5958 though.
| {tokens} replaced, referencing the data property to pull from. | ||
| `{tokens}` replaced, referencing the data property to pull from. (`{token}` | ||
| replacement is only supported for literal `iconImageName` values; not for | ||
| property functions.) |
There was a problem hiding this comment.
mapbox/mapbox-gl-js#5964 adds some links to anchors on the style specification page. The iOS/macOS runtime styling codegen script doesn’t resolve these anchor links to an absolute URL, but we can override the documentation for that platform to talk about something more platform-appropriate. For now, that’d be:
for equivalent functionality in expressions, use concatenate strings and key paths together with the
stringByAppendingString:function.
#8074 (comment) proposes a more intuitive join function, but I can update the override as part of #10726 when I get around to implementing that.
8232df9 to
6888af8
Compare
d5333ae to
5cd6d9d
Compare
6888af8 to
98afbd2
Compare
98afbd2 to
b31f9c2
Compare
b31f9c2 to
5f61dd8
Compare
anandthakker
left a comment
There was a problem hiding this comment.
Expressions & properties parts of this look good to me -- @jfirebaugh is validation the only thing remaining here?
|
Yeah, I'm on the fence about validation. Unlike gl-js, native doesn't have a built out framework for it, and generally just tries to cope with invalid portions of styles (e.g. by ignoring the property or falling back to a default value). |
Fixes #10535. Fixes #9939.
Before getting to the meat of the changes in the last commit, I needed to pay back some technical debt on our generated style code:
make style-code(even though I'm then ignoring-- manually reverting -- all hillshade and heatmap related changes it generates)
make style-codeupdates. Some of these changes undo previous changes to generated files that didn't come with accompanying changes to the source templates (#10810 updated a generated file without changing the source #10846) -- they'll need to be reverted once that bug is fixed. cc @tobrun and @1ec5 for reviews of Android and Darwin changes respectively.