Mercurial > gemma
diff client/src/store/map.js @ 3054:1ef2f4179d30
client: map store: merged/renamed method(s)
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 16 Apr 2019 09:00:42 +0200 |
parents | 61e4feb04a35 |
children | 87e0422cffa7 |
line wrap: on
line diff
--- a/client/src/store/map.js Tue Apr 16 08:42:09 2019 +0200 +++ b/client/src/store/map.js Tue Apr 16 09:00:42 2019 +0200 @@ -26,15 +26,6 @@ import Feature from "ol/Feature"; import Point from "ol/geom/Point"; -const moveMap = ({ view, extent, zoom, preventZoomOut }) => { - const currentZoom = view.getZoom(); - zoom = zoom || currentZoom; - view.fit(extent, { - maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, - duration: 700 - }); -}; - // initial state const init = () => { return { @@ -414,9 +405,14 @@ moveToBoundingBox({ getters }, { boundingBox, zoom, preventZoomOut }) { const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857"); let view = getters.openLayersMap.getView(); - moveMap({ view, extent, zoom, preventZoomOut }); + const currentZoom = view.getZoom(); + zoom = zoom || currentZoom; + view.fit(extent, { + maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, + duration: 700 + }); }, - moveToExtent({ dispatch }, { feature, zoom, preventZoomOut }) { + moveToFeauture({ dispatch }, { feature, zoom, preventZoomOut }) { const boundingBox = bbox(feature.geometry); dispatch("moveToBoundingBox", { boundingBox, zoom, preventZoomOut }); },