gets icon filenames via regex
This commit is contained in:
parent
06ed46f6b8
commit
1113a100d1
@ -83,6 +83,8 @@ var carto = global.carto || require('carto');
|
||||
//
|
||||
setCartoCSS: function(cartocss) {
|
||||
// clean sprites
|
||||
this._getIcons(cartocss);
|
||||
console.log(this._iconNames);
|
||||
this.setShader(new carto.RendererJS().render(cartocss));
|
||||
},
|
||||
|
||||
@ -256,6 +258,17 @@ var carto = global.carto || require('carto');
|
||||
}
|
||||
return positions;
|
||||
},
|
||||
_getIcons: function(cartocss){
|
||||
var re = /marker-file.*\)/g;
|
||||
this._iconNames = cartocss.match(re).map(function(element){
|
||||
element = element.replace("url(", "")
|
||||
.replace(")", "")
|
||||
.replace(";", "")
|
||||
.replace("marker-file:", "")
|
||||
.trim();
|
||||
return element;
|
||||
});
|
||||
},
|
||||
|
||||
// return the value for x, y (tile coordinates)
|
||||
// null for no value
|
||||
@ -292,7 +305,7 @@ var carto = global.carto || require('carto');
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// exports public api
|
||||
|
Loading…
Reference in New Issue
Block a user