diff options
author | Lauren Budorick <lauren@mapbox.com> | 2018-05-14 12:38:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-14 12:38:14 -0700 |
commit | 62c875e01b07197024e3806e8b2882160ce1195c (patch) | |
tree | dbc46834fbc53d4ac70b4b8cc28ef6ac434198c0 /platform/darwin/scripts/generate-style-code.js | |
parent | 07ad29d30da44ded2bf40418b3625fecfb817399 (diff) | |
download | qtlocation-mapboxgl-62c875e01b07197024e3806e8b2882160ce1195c.tar.gz |
[core] Rework spec function/expression taxonomy
Ports https://github.com/mapbox/mapbox-gl-js/pull/6521, updating codegen scripts to parse new expression taxonomy.
Diffstat (limited to 'platform/darwin/scripts/generate-style-code.js')
-rwxr-xr-x | platform/darwin/scripts/generate-style-code.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index c7b54b326a..47106eeac4 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -318,10 +318,11 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { doc += '* Predefined functions, including mathematical and string operators\n' + '* Conditional expressions\n' + '* Variable assignments and references to assigned variables\n'; - const inputVariable = property.name === 'heatmap-color' ? '$heatmapDensity' : '$zoomLevel'; - if (property["property-function"]) { + const inputVariable = property.expression && property['property-type'] === 'color-ramp' ? + '$' + camelizeWithLeadingLowercase(property.expression.parameters[0]) : '$zoomLevel'; + if (isDataDriven(property)) { doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable and/or feature attributes\n`; - } else if (property.function === "interpolated") { + } else if (property.expression && property.expression.interpolated) { doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable\n\n` + 'This property does not support applying interpolation or step functions to feature attributes.'; } else { @@ -332,6 +333,10 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { return doc; }; +global.isDataDriven = function (property) { + return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven'; +}; + global.propertyReqs = function (property, propertiesByName, type) { return 'This property is only applied to the style if ' + property.requires.map(function (req) { if (typeof req === 'string') { |