From 0da0669e802ef7d3f3d2d7fdeb26df0aaf315fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 12 May 2020 11:43:02 +0200 Subject: [PATCH] maps: factor all geojson layer tracking into a single object (#42761) --- combo/apps/maps/static/js/combo.map.js | 93 ++++++++++++-------- combo/apps/maps/templates/maps/map_cell.html | 6 +- 2 files changed, 57 insertions(+), 42 deletions(-) diff --git a/combo/apps/maps/static/js/combo.map.js b/combo/apps/maps/static/js/combo.map.js index bf951445..b05375d0 100644 --- a/combo/apps/maps/static/js/combo.map.js +++ b/combo/apps/maps/static/js/combo.map.js @@ -1,11 +1,33 @@ $(function() { L.Map.include( { - add_geojson_layer: function(callback, geojson_data) { + init_geojson_layers: function(layers) { + if (Array.isArray(layers)) { // backward compatibility + this.geojson_layers = Object(); + for (var i=0; i