summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/redux/reducers
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-16 17:37:01 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-16 17:37:01 +0200
commitf2aeecccc096728d3df955b71e711c8d9c429427 (patch)
tree14494ef902f054a38f93af29976be81f8d5dba75 /opendc-web/opendc-web-ui/src/redux/reducers
parente5caf6c6122684e441d1d73e2e0507fdd36c67e0 (diff)
refactor(ui): Isolate world coordinate space
This change updates the topology view in the OpenDC frontend to isolate the world coordinate space. This means that zooming and panning should not affect the coordinates in world space (but only in camera space). In turn, this allows us to remove the dependency on Redux for the camera controls.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux/reducers')
-rw-r--r--opendc-web/opendc-web-ui/src/redux/reducers/index.js2
-rw-r--r--opendc-web/opendc-web-ui/src/redux/reducers/map.js35
2 files changed, 0 insertions, 37 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/reducers/index.js b/opendc-web/opendc-web-ui/src/redux/reducers/index.js
index 1b17a206..2f1359d6 100644
--- a/opendc-web/opendc-web-ui/src/redux/reducers/index.js
+++ b/opendc-web/opendc-web-ui/src/redux/reducers/index.js
@@ -2,13 +2,11 @@ import { combineReducers } from 'redux'
import { construction } from './construction-mode'
import { currentTopologyId } from './current-ids'
import { interactionLevel } from './interaction-level'
-import { map } from './map'
import { objects } from './objects'
const rootReducer = combineReducers({
objects,
construction,
- map,
currentTopologyId,
interactionLevel,
})
diff --git a/opendc-web/opendc-web-ui/src/redux/reducers/map.js b/opendc-web/opendc-web-ui/src/redux/reducers/map.js
deleted file mode 100644
index de712c15..00000000
--- a/opendc-web/opendc-web-ui/src/redux/reducers/map.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import { combineReducers } from 'redux'
-import { SET_MAP_DIMENSIONS, SET_MAP_POSITION, SET_MAP_SCALE } from '../actions/map'
-
-export function position(state = { x: 0, y: 0 }, action) {
- switch (action.type) {
- case SET_MAP_POSITION:
- return { x: action.x, y: action.y }
- default:
- return state
- }
-}
-
-export function dimensions(state = { width: 600, height: 400 }, action) {
- switch (action.type) {
- case SET_MAP_DIMENSIONS:
- return { width: action.width, height: action.height }
- default:
- return state
- }
-}
-
-export function scale(state = 1, action) {
- switch (action.type) {
- case SET_MAP_SCALE:
- return action.scale
- default:
- return state
- }
-}
-
-export const map = combineReducers({
- position,
- dimensions,
- scale,
-})