diff options
author | Lauren Budorick <lauren@mapbox.com> | 2017-08-28 13:32:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 13:32:56 -0700 |
commit | 2de89a99bc86776c8cadedc0ae9b344fb78b8217 (patch) | |
tree | e930ceb8436646e0d6747f2b3e805bd640f2a436 /platform/darwin/scripts | |
parent | c6ab20e5c69c3705422e49c3511faf3e5ab79b05 (diff) | |
download | qtlocation-mapboxgl-2de89a99bc86776c8cadedc0ae9b344fb78b8217.tar.gz |
Implement icon-anchor property
Diffstat (limited to 'platform/darwin/scripts')
-rw-r--r-- | platform/darwin/scripts/generate-style-code.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index 5a4936c0ee..4ee86e65da 100644 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -148,6 +148,9 @@ global.mbglTestValue = function (property, layerType) { if (/-(rotation|pitch)-alignment$/.test(originalPropertyName(property))) { type = 'Alignment'; } + if (/^(text|icon)-anchor$/.test(originalPropertyName(property))) { + type = 'SymbolAnchor' + } let value = camelize(_.last(_.keys(property.values))); if (property['light-property']) { return `mbgl::style::Light${type}Type::${value}`; @@ -500,6 +503,9 @@ global.mbglType = function(property) { if (/-(rotation|pitch)-alignment$/.test(originalPropertyName(property))) { type = 'Alignment'; } + if (/^(text|icon)-anchor$/.test(originalPropertyName(property))) { + type = 'SymbolAnchor' + } return `mbgl::style::${type}Type`; } case 'color': @@ -648,10 +654,10 @@ while ((match = exampleRegex.exec(examplesSrc)) !== null) { let testMethodName = match[1], indentation = match[2], exampleCode = match[3]; - + // Trim leading whitespace from the example code. exampleCode = exampleCode.replace(new RegExp('^' + indentation, 'gm'), ''); - + examples[testMethodName] = exampleCode; } @@ -663,13 +669,13 @@ global.guideExample = function (guide, exampleId, os) { console.error(`MGLDocumentationExampleTests.test${testMethodName}() not found.`); process.exit(1); } - + // Resolve conditional compilation blocks. example = example.replace(/^(\s*)#if\s+os\((iOS|macOS)\)\n([^]*?)(?:^\1#else\n([^]*?))?^\1#endif\b\n?/gm, function (m, indentation, ifOs, ifCase, elseCase) { return (os === ifOs ? ifCase : elseCase).replace(new RegExp('^ ', 'gm'), ''); }).replace(/\n$/, ''); - + return '```swift\n' + example + '\n```'; }; |