Mercurial > gemma
changeset 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 |
files | client/src/components/map/Map.vue client/src/store/map.js |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/map/Map.vue Tue Apr 16 08:20:37 2019 +0200 +++ b/client/src/components/map/Map.vue Tue Apr 16 08:31:46 2019 +0200 @@ -225,6 +225,9 @@ }); this.$store.dispatch("map/initIdentifyTool", this.map); + }, + destroyed() { + this.$store.commit("map/removeOpenLayersMap", this.map); } }; </script>
--- 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; },