diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-02 18:39:28 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:21 +0200 |
| commit | f119fc78dda4d1e828dde04f378a63a93e3a0a7e (patch) | |
| tree | bea1eace5d47f21a7ccb835c6a6079bc92e48710 /frontend/src/actions/map.js | |
| parent | 7f27a6370a0af25e1bf6ff8f46360c6c26c21e0b (diff) | |
Add current progress on frontend port
Diffstat (limited to 'frontend/src/actions/map.js')
| -rw-r--r-- | frontend/src/actions/map.js | 17 |
1 files changed, 3 insertions, 14 deletions
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 |
