Undo unneeded optimization
This commit is contained in:
parent
8155484510
commit
31e18d04d7
@ -473,32 +473,22 @@ o.instance = function(template, params) {
|
|||||||
all_params[k] = val;
|
all_params[k] = val;
|
||||||
});
|
});
|
||||||
|
|
||||||
// // NOTE: we're deep-cloning the layergroup here
|
// NOTE: we're deep-cloning the layergroup here
|
||||||
var layergroup = JSON.parse(JSON.stringify(template.layergroup));
|
var layergroup = JSON.parse(JSON.stringify(template.layergroup));
|
||||||
var visibility = template.layer_visibility || {};
|
for (var i=0; i<layergroup.layers.length; ++i) {
|
||||||
|
var lyropt = layergroup.layers[i].options;
|
||||||
|
|
||||||
layergroup.layers = layergroup.layers
|
if ( params.styles && params.styles[i] ) {
|
||||||
.map(function (layer, i) {
|
|
||||||
if (visibility[layer.id] === false || visibility[''+i] === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.styles && params.styles[i]) {
|
|
||||||
// dynamic styling for this layer
|
// dynamic styling for this layer
|
||||||
layer.options.cartocss = params.styles[i];
|
lyropt.cartocss = params.styles[i];
|
||||||
} else if (layer.options.cartocss) {
|
} else if ( lyropt.cartocss ) {
|
||||||
layer.options.cartocss = _replaceVars(layer.options.cartocss, all_params);
|
lyropt.cartocss = _replaceVars(lyropt.cartocss, all_params);
|
||||||
}
|
}
|
||||||
|
if ( lyropt.sql) {
|
||||||
if (layer.options.sql) {
|
lyropt.sql = _replaceVars(lyropt.sql, all_params);
|
||||||
layer.options.sql = _replaceVars(layer.options.sql, all_params);
|
}
|
||||||
|
// Anything else ?
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer;
|
|
||||||
})
|
|
||||||
.filter(function (layer) {
|
|
||||||
return !!layer;
|
|
||||||
});
|
|
||||||
|
|
||||||
// extra information about the template
|
// extra information about the template
|
||||||
layergroup.template = {
|
layergroup.template = {
|
||||||
|
Loading…
Reference in New Issue
Block a user