maps: add map.each_marker javascript utility function (#42767)

This commit is contained in:
Frédéric Péters 2020-05-12 13:50:29 +02:00
parent 179f77f4bc
commit e7f053fde8
1 changed files with 14 additions and 1 deletions

View File

@ -129,7 +129,20 @@ $(function() {
if (loading == 0) {
$(cell).trigger('combo:map-markers-ready');
}
}
},
each_marker: function(callback) {
// iterate over all markers, with context(this) being set to relative
// geojson_layer.
var layer_slugs = Object.keys(this.geojson_layers);
for (var i=0; i<layer_slugs.length; i++) {
var layer = this.geojson_layers[layer_slugs[i]];
if (layer.leaflet_layer) {
layer.leaflet_layer.eachLayer(callback, layer);
}
}
},
});
function render_map(cell) {