summaryrefslogtreecommitdiff
path: root/platform/android/scripts/generate-style-code.js
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-06-18 14:43:13 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-08-13 13:32:56 +0300
commitdad43ba8fcd04698230fefa9c6af93931f6c10f3 (patch)
tree3af84d15a40193e5f23870dd56135324e233e670 /platform/android/scripts/generate-style-code.js
parente9ca844d666619886141d7dd8ef943e86f4f55e4 (diff)
downloadqtlocation-mapboxgl-dad43ba8fcd04698230fefa9c6af93931f6c10f3.tar.gz
[android] Android bindings for new 'text-writing-mode' layout property
Diffstat (limited to 'platform/android/scripts/generate-style-code.js')
-rwxr-xr-xplatform/android/scripts/generate-style-code.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js
index 8c34113de1..fa814f89af 100755
--- a/platform/android/scripts/generate-style-code.js
+++ b/platform/android/scripts/generate-style-code.js
@@ -49,10 +49,19 @@ var layers = Object.keys(spec.layer.type.values).map((type) => {
});
// Process all layer properties
+const uniqueArrayEnum = (prop, enums) => {
+ if (prop.value !== 'enum') return false;
+ const enumsEqual = (val1, val2) => val1.length === val1.length && val1.every((val, i) => val === val2[i]);
+ return enums.filter(e => enumsEqual(Object.keys(prop.values).sort(), Object.keys(e.values).sort())).length == 0;
+};
+
const layoutProperties = _(layers).map('layoutProperties').flatten().value();
const paintProperties = _(layers).map('paintProperties').flatten().value();
const allProperties = _(layoutProperties).union(paintProperties).union(lightProperties).value();
-const enumProperties = _(allProperties).filter({'type': 'enum'}).value();
+let allEnumProperties = _(allProperties).filter({'type': 'enum'}).value();
+const uniqueArrayEnumProperties = _(allProperties).filter({'type': 'array'}).filter(prop => uniqueArrayEnum(prop, allEnumProperties)).value();
+const enumProperties = _(allEnumProperties).union(uniqueArrayEnumProperties).value();
+
global.propertyType = function propertyType(property) {
switch (property.type) {