diff client/src/store/map.js @ 3052:01210542e028

client: remove openlayers map objects after removing a map component from the view
author Markus Kottlaender <markus@intevation.de>
date Tue, 16 Apr 2019 08:31:46 +0200
parents 051a3f446ac2
children 61e4feb04a35
line wrap: on
line diff
--- a/client/src/store/map.js	Tue Apr 16 08:20:37 2019 +0200
+++ b/client/src/store/map.js	Tue Apr 16 08:31:46 2019 +0200
@@ -78,6 +78,14 @@
     addOpenLayersMap: (state, map) => {
       state.openLayersMaps.push(map);
     },
+    removeOpenLayersMap: (state, map) => {
+      let index = state.openLayersMaps.findIndex(
+        m => m.getTarget() === map.getTarget()
+      );
+      if (index !== -1) {
+        state.openLayersMaps.splice(index);
+      }
+    },
     identifyToolEnabled: (state, enabled) => {
       state.identifyToolEnabled = enabled;
     },