summaryrefslogtreecommitdiff
path: root/platform/darwin/scripts/generate-style-code.js
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-01-06 12:29:03 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-01-07 15:47:31 -0800
commitbf8d037fca3a5e76818f2cd546e783814f046019 (patch)
treed7d3522a5b7a2113a6c4fcf29b7b77ab6ed931e5 /platform/darwin/scripts/generate-style-code.js
parent17b3ec1edd217b8b14d64b74cbf58b0e4ae4f241 (diff)
downloadqtlocation-mapboxgl-bf8d037fca3a5e76818f2cd546e783814f046019.tar.gz
[ios, macos] -translate → -translation
Diffstat (limited to 'platform/darwin/scripts/generate-style-code.js')
-rw-r--r--platform/darwin/scripts/generate-style-code.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index a7421da103..dfc0d64ec2 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -256,16 +256,18 @@ global.describeValue = function (value, property, layerType) {
if (units) {
units = ` ${units}`.replace(/pixel/, 'point');
}
- if (property.name.indexOf('padding') !== -1) {
- if (value[0] === 0 && value[1] === 0 && value[2] === 0 && value[3] === 0) {
- return 'an `NSValue` object containing `NSEdgeInsetsZero` or `UIEdgeInsetsZero`';
- }
- return 'an `NSValue` object containing an `NSEdgeInsets` or `UIEdgeInsets` struct set to' + ` ${value[0]}${units} on the top, ${value[3]}${units} on the left, ${value[2]}${units} on the bottom, and ${value[1]}${units} on the right`;
- }
- if (property.name.indexOf('offset') !== -1 || property.name.indexOf('translate') !== -1) {
- return 'an `NSValue` object containing a `CGVector` struct set to' + ` ${value[0]}${units} from the left and ${value[1]}${units} from the top`;
+ switch (arrayType(property)) {
+ case 'padding':
+ if (value[0] === 0 && value[1] === 0 && value[2] === 0 && value[3] === 0) {
+ return 'an `NSValue` object containing `NSEdgeInsetsZero` or `UIEdgeInsetsZero`';
+ }
+ return 'an `NSValue` object containing an `NSEdgeInsets` or `UIEdgeInsets` struct set to' + ` ${value[0]}${units} on the top, ${value[3]}${units} on the left, ${value[2]}${units} on the bottom, and ${value[1]}${units} on the right`;
+ case 'offset':
+ case 'translate':
+ return 'an `NSValue` object containing a `CGVector` struct set to' + ` ${value[0]}${units} from the left and ${value[1]}${units} from the top`;
+ default:
+ return 'the array `' + value.join('`, `') + '`';
}
- return 'the array `' + value.join('`, `') + '`';
default:
throw new Error(`unknown type for ${property.name}`);
}