diff options
Diffstat (limited to 'scripts/generate-style-code.js')
-rw-r--r-- | scripts/generate-style-code.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index c169c4ecd5..fe9a1a906b 100644 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -29,6 +29,9 @@ global.evaluatedType = function (property) { if (/-(rotation|pitch|illumination)-alignment$/.test(property.name)) { return 'AlignmentType'; } + if (/^(text|icon)-anchor$/.test(property.name)) { + return 'SymbolAnchorType'; + } if (/position/.test(property.name)) { return 'Position'; } @@ -53,7 +56,7 @@ global.evaluatedType = function (property) { } }; -function attributeType(property, type) { +function attributeUniformType(property, type) { const attributeNameExceptions = { 'text-opacity': 'opacity', 'icon-opacity': 'opacity', @@ -64,11 +67,12 @@ function attributeType(property, type) { 'text-halo-blur': 'halo_blur', 'icon-halo-blur': 'halo_blur', 'text-halo-width': 'halo_width', - 'icon-halo-width': 'halo_width' + 'icon-halo-width': 'halo_width', + 'line-gap-width': 'gapwidth' } const name = attributeNameExceptions[property.name] || property.name.replace(type + '-', '').replace(/-/g, '_'); - return `attributes::a_${name}${name === 'offset' ? '<1>' : ''}`; + return `attributes::a_${name}${name === 'offset' ? '<1>' : ''}, uniforms::u_${name}`; } global.layoutPropertyType = function (property) { @@ -81,7 +85,7 @@ global.layoutPropertyType = function (property) { global.paintPropertyType = function (property, type) { if (isDataDriven(property)) { - return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeType(property, type)}>`; + return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeUniformType(property, type)}>`; } else if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { return `CrossFadedPaintProperty<${evaluatedType(property)}>`; } else { |