From f119fc78dda4d1e828dde04f378a63a93e3a0a7e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 2 Jul 2020 18:39:28 +0200 Subject: Add current progress on frontend port --- frontend/src/actions/map.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'frontend/src/actions/map.js') diff --git a/frontend/src/actions/map.js b/frontend/src/actions/map.js index 4ab767f7..0d49d849 100644 --- a/frontend/src/actions/map.js +++ b/frontend/src/actions/map.js @@ -36,13 +36,7 @@ export function zoomInOnCenter(zoomIn) { return (dispatch, getState) => { const state = getState() - dispatch( - zoomInOnPosition( - zoomIn, - state.map.dimensions.width / 2, - state.map.dimensions.height / 2, - ), - ) + dispatch(zoomInOnPosition(zoomIn, state.map.dimensions.width / 2, state.map.dimensions.height / 2)) } } @@ -54,13 +48,8 @@ export function zoomInOnPosition(zoomIn, x, y) { x: x / state.map.scale - state.map.position.x / state.map.scale, y: y / state.map.scale - state.map.position.y / state.map.scale, } - const newScale = zoomIn - ? state.map.scale * MAP_SCALE_PER_EVENT - : state.map.scale / MAP_SCALE_PER_EVENT - const boundedScale = Math.min( - Math.max(MAP_MIN_SCALE, newScale), - MAP_MAX_SCALE, - ) + const newScale = zoomIn ? state.map.scale * MAP_SCALE_PER_EVENT : state.map.scale / MAP_SCALE_PER_EVENT + const boundedScale = Math.min(Math.max(MAP_MIN_SCALE, newScale), MAP_MAX_SCALE) const newX = -(centerPoint.x - x / boundedScale) * boundedScale const newY = -(centerPoint.y - y / boundedScale) * boundedScale -- cgit v1.2.3