Mercurial > gemma
comparison client/src/store/map.js @ 1096:aa1f5daf6fc9
refac: centralized stores
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 30 Oct 2018 16:55:29 +0100 |
parents | client/src/map/store.js@ca628dce90dd |
children | 1f4799bab8a6 |
comparison
equal
deleted
inserted
replaced
1095:2d6d8b676e3f | 1096:aa1f5daf6fc9 |
---|---|
1 /* | |
2 * This is Free Software under GNU Affero General Public License v >= 3.0 | |
3 * without warranty, see README.md and license for details. | |
4 * | |
5 * SPDX-License-Identifier: AGPL-3.0-or-later | |
6 * License-Filename: LICENSES/AGPL-3.0.txt | |
7 * | |
8 * Copyright (C) 2018 by via donau | |
9 * – Österreichische Wasserstraßen-Gesellschaft mbH | |
10 * Software engineering by Intevation GmbH | |
11 * | |
12 * Author(s): | |
13 * Thomas Junk <thomas.junk@intevation.de> | |
14 */ | |
15 | |
16 //import { HTTP } from "../lib/http"; | |
17 | |
18 import { layers } from "../layers/layers"; | |
19 | |
20 const MapStore = { | |
21 namespaced: true, | |
22 state: { | |
23 openLayersMap: null, | |
24 layers: layers | |
25 }, | |
26 getters: { | |
27 layers: state => { | |
28 return state.layers; | |
29 }, | |
30 getLayerByName: state => name => { | |
31 return state.layers.find(layer => layer.name === name); | |
32 } | |
33 }, | |
34 mutations: { | |
35 toggleVisibility: (state, layer) => { | |
36 state.layers[layer].isVisible = !state.layers[layer].isVisible; | |
37 state.layers[layer].data.setVisible(state.layers[layer].isVisible); | |
38 }, | |
39 setOpenLayersMap: (state, map) => { | |
40 state.openLayersMap = map; | |
41 } | |
42 } | |
43 }; | |
44 | |
45 export default MapStore; |