diff options
author | Randall Lee <randall.lee@mapbox.com> | 2018-05-22 14:09:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 14:09:36 -0400 |
commit | d858cb783b499a1cc77b48a0faee137ca5e6a423 (patch) | |
tree | 5c36c353730e3050d44e472545519c0429723266 /scripts/generate-style-code.js | |
parent | f93d722458be62d567aa152711a014ef51a90193 (diff) | |
parent | 60505b03174b5ec02ae723beafa7683f6ed54a62 (diff) | |
download | qtlocation-mapboxgl-d858cb783b499a1cc77b48a0faee137ca5e6a423.tar.gz |
Merge branch 'master' into rclee-async-setupupstream/rclee-async-setup
Diffstat (limited to 'scripts/generate-style-code.js')
-rwxr-xr-x | scripts/generate-style-code.js | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 6ddb787f19..0059863e05 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -15,10 +15,6 @@ function parseCSSColor(str) { ]; } -global.isDataDriven = function (property) { - return property['property-function'] === true; -}; - global.isLightProperty = function (property) { return property['light-property'] === true; }; @@ -77,30 +73,36 @@ function attributeUniformType(property, type) { } global.layoutPropertyType = function (property) { - if (isDataDriven(property)) { - return `DataDrivenLayoutProperty<${evaluatedType(property)}>`; - } else { - return `LayoutProperty<${evaluatedType(property)}>`; + switch (property['property-type']) { + case 'data-driven': + case 'cross-faded-data-driven': + return `DataDrivenLayoutProperty<${evaluatedType(property)}>`; + default: + return `LayoutProperty<${evaluatedType(property)}>`; } }; global.paintPropertyType = function (property, type) { - if (isDataDriven(property)) { - return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeUniformType(property, type)}>`; - } else if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { - return `CrossFadedPaintProperty<${evaluatedType(property)}>`; - } else { - return `PaintProperty<${evaluatedType(property)}>`; + switch (property['property-type']) { + case 'data-driven': + case 'cross-faded-data-driven': + return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeUniformType(property, type)}>`; + case 'cross-faded': + return `CrossFadedPaintProperty<${evaluatedType(property)}>`; + default: + return `PaintProperty<${evaluatedType(property)}>`; } }; global.propertyValueType = function (property) { - if (isDataDriven(property)) { - return `DataDrivenPropertyValue<${evaluatedType(property)}>`; - } else if (property.name === 'heatmap-color') { - return `HeatmapColorPropertyValue`; - } else { - return `PropertyValue<${evaluatedType(property)}>`; + switch (property['property-type']) { + case 'data-driven': + case 'cross-faded-data-driven': + return `DataDrivenPropertyValue<${evaluatedType(property)}>`; + case 'color-ramp': + return `HeatmapColorPropertyValue`; + default: + return `PropertyValue<${evaluatedType(property)}>`; } }; |