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;
|
||||
});
|
||||
|
||||
// // NOTE: we're deep-cloning the layergroup here
|
||||
var layergroup = JSON.parse(JSON.stringify(template.layergroup));
|
||||
var visibility = template.layer_visibility || {};
|
||||
// NOTE: we're deep-cloning the layergroup here
|
||||
var layergroup = JSON.parse(JSON.stringify(template.layergroup));
|
||||
for (var i=0; i<layergroup.layers.length; ++i) {
|
||||
var lyropt = layergroup.layers[i].options;
|
||||
|
||||
layergroup.layers = layergroup.layers
|
||||
.map(function (layer, i) {
|
||||
if (visibility[layer.id] === false || visibility[''+i] === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params.styles && params.styles[i]) {
|
||||
// dynamic styling for this layer
|
||||
layer.options.cartocss = params.styles[i];
|
||||
} else if (layer.options.cartocss) {
|
||||
layer.options.cartocss = _replaceVars(layer.options.cartocss, all_params);
|
||||
}
|
||||
|
||||
if (layer.options.sql) {
|
||||
layer.options.sql = _replaceVars(layer.options.sql, all_params);
|
||||
}
|
||||
|
||||
return layer;
|
||||
})
|
||||
.filter(function (layer) {
|
||||
return !!layer;
|
||||
});
|
||||
if ( params.styles && params.styles[i] ) {
|
||||
// dynamic styling for this layer
|
||||
lyropt.cartocss = params.styles[i];
|
||||
} else if ( lyropt.cartocss ) {
|
||||
lyropt.cartocss = _replaceVars(lyropt.cartocss, all_params);
|
||||
}
|
||||
if ( lyropt.sql) {
|
||||
lyropt.sql = _replaceVars(lyropt.sql, all_params);
|
||||
}
|
||||
// Anything else ?
|
||||
}
|
||||
|
||||
// extra information about the template
|
||||
layergroup.template = {
|
||||
|
Loading…
Reference in New Issue
Block a user