From 52865c97f820b883977179930ce4961abdb39c12 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 3 Jul 2020 11:46:29 +0200 Subject: Fix integer IDs and topology deletion --- frontend/src/store/middlewares/viewport-adjustment.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'frontend/src/store') diff --git a/frontend/src/store/middlewares/viewport-adjustment.js b/frontend/src/store/middlewares/viewport-adjustment.js index ae8f032a..84f2a3e9 100644 --- a/frontend/src/store/middlewares/viewport-adjustment.js +++ b/frontend/src/store/middlewares/viewport-adjustment.js @@ -12,20 +12,20 @@ import { calculateRoomListBounds } from '../../util/tile-calculations' export const viewportAdjustmentMiddleware = store => next => action => { const state = store.getState() - let topologyId = -1 + let topologyId = '-1' let mapDimensions = {} - if (action.type === SET_CURRENT_TOPOLOGY && action.topologyId !== -1) { + if (action.type === SET_CURRENT_TOPOLOGY && action.topologyId !== '-1') { topologyId = action.topologyId mapDimensions = state.map.dimensions } else if ( action.type === SET_MAP_DIMENSIONS && - state.currentTopologyId !== -1 + state.currentTopologyId !== '-1' ) { topologyId = state.currentTopologyId mapDimensions = { width: action.width, height: action.height } } - if (topologyId !== -1) { + if (topologyId !== '-1') { const roomIds = state.objects.topology[topologyId].roomIds const rooms = roomIds.map(id => Object.assign({}, state.objects.room[id])) rooms.forEach( -- cgit v1.2.3