Skip to content

Commit

Permalink
Fixed string template in icon-image
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Jul 11, 2016
1 parent baf963b commit 471f003
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions js/data/bucket/symbol_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,13 @@ SymbolBucket.prototype.populateBuffers = function(collisionTile, stacks, icons)

if (layout['icon-image']) {
var iconNames = resolveStringValue(features[k].properties, layout['icon-image'], true);
var iconName = '';
var image;
for (var i = 0; i < iconNames.length; i++) {
if (iconNames[i] in icons) {
iconName = iconNames[i];
image = icons[iconNames[i]];
break;
}
}
var image = icons[iconName];
shapedIcon = shapeIcon(image, layout);

if (image) {
Expand Down
4 changes: 2 additions & 2 deletions js/util/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ module.exports = resolveStringValue;
function resolveStringValue(properties, value, all) {
var results = [];
if (typeof value === 'string') {
return value.replace(/{([^{}]+)}/g, function(match, ref) {
results.push(value.replace(/{([^{}]+)}/g, function(match, ref) {
return ref in properties ? properties[ref] : '';
});
}));
} else if (typeof value === 'object' && value.type === 'selection') {
var cases = value.cases;
for (var i = 0; i < cases.length; i++) {
Expand Down

0 comments on commit 471f003

Please sign in to comment.