Add array support for icon-padding (#2845)

This commit is contained in:
Alexey Kon
2024-09-20 17:17:33 -07:00
committed by GitHub
parent 58dd529790
commit 9d553c2843
56 changed files with 902 additions and 104 deletions

View File

@@ -56,6 +56,8 @@ function expressionType(property) {
return 'StringType';
case 'color':
return `ColorType`;
case 'padding':
return `PaddingType`;
case 'formatted':
return `FormattedType`;
case 'array':
@@ -104,6 +106,8 @@ function evaluatedType(property) {
return (isLightProperty(property) ? 'Light' : '') + `${camelize(property.name)}Type`;
case 'color':
return `Color`;
case 'padding':
return `Padding`;
case 'array':
if (property.length) {
return `std::array<${evaluatedType({type: property.value, name: property.name})}, ${property.length}>`;
@@ -248,6 +252,7 @@ function defaultValue(property) {
return `{ ${color} }`;
}
case 'array':
case 'padding':
const defaults = (property.default || []).map((/** @type {any} **/ e) => defaultValue({ type: property.value, default: e }));
if (property.length) {
return `{{${defaults.join(', ')}}}`;

View File

@@ -1,13 +1,5 @@
import referenceSpec from './style-spec-reference/v8.json' with { type: "json" };
// https://github.com/maplibre/maplibre-native/issues/2368
referenceSpec['layout_symbol']['icon-padding']['type'] = 'number';
// @ts-ignore
referenceSpec['layout_symbol']['icon-padding']['default'] = 2;
// https://github.com/maplibre/maplibre-native/issues/2754
referenceSpec['layout_symbol']['icon-padding']['property-type'] = 'data constant';
/** @type {any} */
let modifiedReferenceSpec = referenceSpec;