Mercurial > gemma
comparison client/src/components/layers/Layers.vue @ 3181:c122a064fd5e
client: map: fixed loading animation for layers
Zooming out to the user specific map extent right after the map has been rendered initially
interrupts the loading process for layers with a maxResolution that is exceeded by that.
This leads to the loading flag of the layer source to be never set to false until you zoom
to a resolution where these layers are active again. This is an unexpected behavior that will
be reported to upstream. (https://github.com/openlayers/openlayers/issues/9503)
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 07 May 2019 14:54:16 +0200 |
parents | fc008b32c593 |
children | 80037790032d |
comparison
equal
deleted
inserted
replaced
3180:429e28295902 | 3181:c122a064fd5e |
---|---|
9 <UIBoxHeader | 9 <UIBoxHeader |
10 icon="layer-group" | 10 icon="layer-group" |
11 :title="label" | 11 :title="label" |
12 :closeCallback="close" | 12 :closeCallback="close" |
13 :actions="[ | 13 :actions="[ |
14 { callback: refreshLayers, icon: mapsLoading ? 'spinner' : 'sync' } | 14 { |
15 callback: refreshLayers, | |
16 icon: sourcesLoading ? 'spinner' : 'sync' | |
17 } | |
15 ]" | 18 ]" |
16 /> | 19 /> |
17 <div class="small" v-if="openLayersMaps.length"> | 20 <div class="small" v-if="openLayersMaps.length"> |
18 <Layerselect layerId="OPENSTREETMAP" /> | 21 <Layerselect layerId="OPENSTREETMAP" /> |
19 <Layerselect layerId="INLANDECDIS" /> | 22 <Layerselect layerId="INLANDECDIS" /> |
59 components: { | 62 components: { |
60 Layerselect: () => import("./Layerselect") | 63 Layerselect: () => import("./Layerselect") |
61 }, | 64 }, |
62 computed: { | 65 computed: { |
63 ...mapState("application", ["showLayers"]), | 66 ...mapState("application", ["showLayers"]), |
64 ...mapState("map", ["openLayersMaps", "mapsLoading"]), | 67 ...mapState("map", ["openLayersMaps"]), |
65 label() { | 68 label() { |
66 return this.$gettext("Layers"); | 69 return this.$gettext("Layers"); |
70 }, | |
71 sourcesLoading() { | |
72 let counter = 0; | |
73 this.openLayersMaps.forEach(map => { | |
74 let layers = map.getLayers().getArray(); | |
75 for (let i = 0; i < layers.length; i++) { | |
76 if (layers[i].getSource().loading) counter++; | |
77 } | |
78 }); | |
79 return counter; | |
67 } | 80 } |
68 }, | 81 }, |
69 methods: { | 82 methods: { |
70 close() { | 83 close() { |
71 this.$store.commit("application/showLayers", false); | 84 this.$store.commit("application/showLayers", false); |
72 }, | 85 }, |
73 refreshLayers() { | 86 refreshLayers() { |
74 this.openLayersMaps.forEach(map => { | 87 this.openLayersMaps.forEach(map => { |
75 this.$store.commit("map/increaseMapsLoading"); | |
76 let layers = map.getLayers().getArray(); | 88 let layers = map.getLayers().getArray(); |
77 for (let i = 0; i < layers.length; i++) { | 89 for (let i = 0; i < layers.length; i++) { |
78 let layer = layers[i]; | 90 let layer = layers[i]; |
79 if ( | 91 if ( |
80 layer instanceof VectorLayer && | 92 layer instanceof VectorLayer && |