From 481c9477bbec91eaf2fe2d975f361930d453a001 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Sat, 2 Feb 2019 17:40:52 +0100 Subject: [PATCH] current layer cache --- server/static/js/overlays/TravelnetOverlay.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/static/js/overlays/TravelnetOverlay.js b/server/static/js/overlays/TravelnetOverlay.js index 0e8235b..a9ede83 100644 --- a/server/static/js/overlays/TravelnetOverlay.js +++ b/server/static/js/overlays/TravelnetOverlay.js @@ -15,6 +15,8 @@ var TravelnetOverlay = L.LayerGroup.extend({ this.layerMgr = layerMgr; this.wsChannel = wsChannel; + this.currentLayers = []; + this.onLayerChange = this.onLayerChange.bind(this); this.onMapMove = debounce(this.onMapMove.bind(this), 50); }, @@ -30,15 +32,18 @@ var TravelnetOverlay = L.LayerGroup.extend({ reDraw: function(full){ var self = this; - if (full) + if (full){ this.clearLayers(); + this.currentLayers = []; + } //TODO: get coords api.getMapObjects(-10,-10,-10,10,10,10,"travelnet") .then(function(travelnets){ //TODO: remove non-existing markers, add new ones - if (!full) + if (!full){ self.clearLayers(); + } travelnets.forEach(function(travelnet){