-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: add expression-dependency
key to spec properties that depend on internal calculations
#6389
Comments
We'd also want to add a special key ( mapbox-gl-js/src/style-spec/reference/v8.json Lines 2322 to 2329 in 3c07b72
|
I wonder if it makes sense to consider the other expression-related style-spec properties at the same time:
In particular, the latter two say something similar to what we're trying to say for What about something like: expression: {
interpolated: true | false // replaces function: "interpolated" | "piecewise-constant",
// and defaults to true for number, color, or array
// of number/color
parameters: Array<"zoom" | "feature" | "heatmap-density" | "line-progress">
} So, e.g.: "circle-color": {
"expression": {
"parameters": ["zoom", "feature"]
}
}
"heatmap-color": {
"expression": {
"parameters": ["heatmap-density"]
}
}
"line-gradient": {
"expression": {
"parameters": ["line-progress"]
}
}
"line-dasharray": {
"expression": {
"interpolated": false
"parameters": ["zoom"]
}
} The I'm not sure if I actually like namespacing these under |
Above suggestions sound good to me. One thing to look at is what will the switch (property.type) {
case 'data-driven':
return `DataDrivenProperty<${flowType(property)}>`;
case 'cross-faded-data-driven': // https://github.com/mapbox/mapbox-gl-js/pull/6303
return `CrossFadedDataDrivenProperty <${flowType(property)}>`;
case 'cross-faded':
return `CrossFadedProperty<${flowType(property)}>`;
case 'color-ramp':
return `ColorRampProperty`;
default:
return `DataConstantProperty<${flowType(property)}>`;
} |
would something like this cover all the special casing we have now? example for a property like "expression": {
"property-type": "cross-faded-data-driven", // new per @jfirebaugh's previous comment
"interpolated": false, // replaces function: "interpolated" | "piecewise-constant",
"parameters": ["zoom", "feature"] // Array<"zoom" | "feature" | "heatmap-density" | "line-progress">
// replaces "zoom-function" ,`dependency` , 'property-function'
} |
@mollymerp are you just hesitant about the term "parameters" or is there a feature/special case of |
👍 @mollymerp. |
@lbud oh, yes just the former. just because I think of |
Following from #6303 (comment), this is a proposal to add a new spec key,
expression-dependency
, for paint/layout properties whose display is linked to a special calculated property. These keys have string vales that specify the name of the internally calculated property upon which they depend, so currently those would be (including #6303):By adding a spec key we can remove special casing code, pave the way for future related properties, and move these specific instructions out of the docstrings (e.g.) and into generated documentation.
Thoughts, semantic or otherwise? @mapbox/gl-core
The text was updated successfully, but these errors were encountered: