diff client/src/store/map.js @ 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 1253fe15e3e3
line wrap: on
line diff
--- a/client/src/store/map.js	Tue May 07 14:06:23 2019 +0200
+++ b/client/src/store/map.js	Tue May 07 14:54:16 2019 +0200
@@ -32,7 +32,6 @@
     openLayersMaps: [],
     syncedMaps: [],
     syncedView: null,
-    mapsLoading: 0,
     initialLoad: true,
     extent: {
       lat: 6155376,
@@ -64,13 +63,6 @@
     }
   },
   mutations: {
-    increaseMapsLoading: state => {
-      state.mapsLoading++;
-    },
-    decreaseMapsLoading: state => {
-      state.mapsLoading--;
-      if (state.mapsLoading < 0) state.mapsLoading = 0;
-    },
     initialLoad: (state, initialLoad) => {
       state.initialLoad = initialLoad;
     },
@@ -526,13 +518,16 @@
         }
       });
     },
-    moveToBoundingBox({ state }, { boundingBox, zoom, preventZoomOut }) {
+    moveToBoundingBox(
+      { state },
+      { boundingBox, zoom, preventZoomOut, duration }
+    ) {
       const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857");
       const currentZoom = state.syncedView.getZoom();
       zoom = zoom || currentZoom;
       state.syncedView.fit(extent, {
         maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
-        duration: 700
+        duration: duration || 700
       });
     },
     moveToFeauture({ dispatch }, { feature, zoom, preventZoomOut }) {