comparison client/src/store/map.js @ 1643:1fde2f48977b

fix: calculate center to zoom to via turfjs
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 20 Dec 2018 14:18:30 +0100
parents f034371c5d11
children 14bb1289b97b bad32adafef2
comparison
equal deleted inserted replaced
1642:49c04bb64e0a 1643:1fde2f48977b
383 }, 383 },
384 cutTool: (state, cutTool) => { 384 cutTool: (state, cutTool) => {
385 state.cutTool = cutTool; 385 state.cutTool = cutTool;
386 }, 386 },
387 moveMap: (state, { coordinates, zoom, preventZoomOut }) => { 387 moveMap: (state, { coordinates, zoom, preventZoomOut }) => {
388 console.assert(state.openLayersMap, "no Map found"); // inserted during bug hunt
389 let view = state.openLayersMap.getView(); 388 let view = state.openLayersMap.getView();
390 console.assert(view, "no view found"); // inserted during bug hunt
391 const currentZoom = view.getZoom(); 389 const currentZoom = view.getZoom();
392 view.animate({ 390 view.animate({
393 zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, 391 zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
394 center: fromLonLat(coordinates, view.getProjection()), 392 center: fromLonLat(coordinates, view.getProjection()),
395 duration: 700 393 duration: 700