From bbb802b4142d11f020994ac4d9ae9c1610ac4038 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Sat, 26 Aug 2017 13:53:21 +0200 Subject: Enable going from room to tile and back --- src/components/map/groups/RoomGroup.js | 43 ++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'src/components/map/groups/RoomGroup.js') diff --git a/src/components/map/groups/RoomGroup.js b/src/components/map/groups/RoomGroup.js index 179a24a2..b6c285e9 100644 --- a/src/components/map/groups/RoomGroup.js +++ b/src/components/map/groups/RoomGroup.js @@ -1,22 +1,39 @@ import React from "react"; import {Group} from "react-konva"; +import GrayContainer from "../../../containers/map/GrayContainer"; +import TileContainer from "../../../containers/map/TileContainer"; import Shapes from "../../../shapes/index"; import {deriveWallLocations} from "../../../util/tile-calculations"; import WallSegment from "../elements/WallSegment"; -import TileGroup from "./TileGroup"; -const RoomGroup = ({room, onClick}) => ( - - {room.tiles.map(tile => ( - - ))} - {deriveWallLocations(room).map((wallSegment, index) => ( - - ))} - -); +const RoomGroup = ({room, interactionLevel, onClick}) => { + return ( + + {(() => { + if (interactionLevel.mode === "OBJECT" && interactionLevel.roomId === room.id) { + return [ + room.tiles + .filter(tile => tile.id !== interactionLevel.tileId) + .map(tile => ), + , + room.tiles + .filter(tile => tile.id === interactionLevel.tileId) + .map(tile => ) + ]; + } else { + return room.tiles.map(tile => ( + + )); + } + })()} + {deriveWallLocations(room).map((wallSegment, index) => ( + + ))} + + ); +}; RoomGroup.propTypes = { room: Shapes.Room, -- cgit v1.2.3