Mercurial > gemma
comparison client/src/store/map.js @ 4865:e51b9b265df0
right click toggles single layer selection
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 12 Dec 2019 17:13:34 +0100 |
parents | ad271887fd8d |
children | 9d57c5765474 |
comparison
equal
deleted
inserted
replaced
4864:6a148617e012 | 4865:e51b9b265df0 |
---|---|
28 import { toLonLat } from "ol/proj"; | 28 import { toLonLat } from "ol/proj"; |
29 | 29 |
30 // initial state | 30 // initial state |
31 const init = () => { | 31 const init = () => { |
32 return { | 32 return { |
33 oldLayerVisibility: [], | |
34 singleLayerVisible: false, | |
33 openLayersMaps: [], | 35 openLayersMaps: [], |
34 syncedMaps: [], | 36 syncedMaps: [], |
35 syncedView: null, | 37 syncedView: null, |
36 mapPopup: null, | 38 mapPopup: null, |
37 mapPopupEnabled: true, | 39 mapPopupEnabled: true, |
67 filteredIdentifiedFeatures: state => { | 69 filteredIdentifiedFeatures: state => { |
68 return state.identifiedFeatures.filter(f => f.getId()); | 70 return state.identifiedFeatures.filter(f => f.getId()); |
69 } | 71 } |
70 }, | 72 }, |
71 mutations: { | 73 mutations: { |
74 viewSingleLayer: (state, layerId) => { | |
75 state.singleLayerVisible = !state.singleLayerVisible; | |
76 if (state.singleLayerVisible) { | |
77 state.oldLayerVisibility = state.openLayersMaps.reduce((o, m) => { | |
78 let current = []; | |
79 m.getLayers().forEach(l => { | |
80 current.push(l.getVisible()); | |
81 l.setVisible(l.get("id") == layerId); | |
82 }); | |
83 o.push(current); | |
84 return o; | |
85 }, []); | |
86 } else { | |
87 state.oldLayerVisibility.forEach((m, i) => { | |
88 let layers = state.openLayersMaps[i].getLayers().getArray(); | |
89 m.forEach((visible, index) => { | |
90 layers[index].setVisible(visible); | |
91 }); | |
92 }); | |
93 } | |
94 }, | |
72 reviewActive: (state, active) => { | 95 reviewActive: (state, active) => { |
73 state.reviewActive = active; | 96 state.reviewActive = active; |
74 }, | 97 }, |
75 startRefreshLayers: state => { | 98 startRefreshLayers: state => { |
76 state.ongoingRefresh = true; | 99 state.ongoingRefresh = true; |