summaryrefslogtreecommitdiff
path: root/frontend/src/containers/app/map/layers/RoomHoverLayer.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-25 21:53:42 +0200
committerGitHub <noreply@github.com>2021-04-25 21:53:42 +0200
commit128f76f7fd7c8abb41a3bbbd9f1980cbc20ae7a5 (patch)
treeadd513890005233a7784466797bfe6f5052e9eeb /frontend/src/containers/app/map/layers/RoomHoverLayer.js
parent128a1db017545597a5c035b7960eb3fd36b5f987 (diff)
parent57b54b59ed74ec37338ae26b3864d051255aba49 (diff)
build: Flatten project structure
This change updates the project structure to become flattened. Previously, the simulator, frontend and API each lived into their own directory. With this change, all modules of the project live in the top-level directory of the repository.
Diffstat (limited to 'frontend/src/containers/app/map/layers/RoomHoverLayer.js')
-rw-r--r--frontend/src/containers/app/map/layers/RoomHoverLayer.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/frontend/src/containers/app/map/layers/RoomHoverLayer.js b/frontend/src/containers/app/map/layers/RoomHoverLayer.js
deleted file mode 100644
index 66404f9e..00000000
--- a/frontend/src/containers/app/map/layers/RoomHoverLayer.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import { connect } from 'react-redux'
-import { toggleTileAtLocation } from '../../../../actions/topology/building'
-import RoomHoverLayerComponent from '../../../../components/app/map/layers/RoomHoverLayerComponent'
-import {
- deriveValidNextTilePositions,
- findPositionInPositions,
- findPositionInRooms,
-} from '../../../../util/tile-calculations'
-
-const mapStateToProps = (state) => {
- return {
- mapPosition: state.map.position,
- mapScale: state.map.scale,
- isEnabled: () => state.construction.currentRoomInConstruction !== '-1',
- isValid: (x, y) => {
- const newRoom = Object.assign({}, state.objects.room[state.construction.currentRoomInConstruction])
- const oldRooms = Object.keys(state.objects.room)
- .map((id) => Object.assign({}, state.objects.room[id]))
- .filter(
- (room) =>
- state.objects.topology[state.currentTopologyId].roomIds.indexOf(room._id) !== -1 &&
- room._id !== state.construction.currentRoomInConstruction
- )
-
- ;[...oldRooms, newRoom].forEach((room) => {
- room.tiles = room.tileIds.map((tileId) => state.objects.tile[tileId])
- })
- if (newRoom.tileIds.length === 0) {
- return findPositionInRooms(oldRooms, x, y) === -1
- }
-
- const validNextPositions = deriveValidNextTilePositions(oldRooms, newRoom.tiles)
- return findPositionInPositions(validNextPositions, x, y) !== -1
- },
- }
-}
-
-const mapDispatchToProps = (dispatch) => {
- return {
- onClick: (x, y) => dispatch(toggleTileAtLocation(x, y)),
- }
-}
-
-const RoomHoverLayer = connect(mapStateToProps, mapDispatchToProps)(RoomHoverLayerComponent)
-
-export default RoomHoverLayer