diff options
Diffstat (limited to 'src/components/map/elements/TileObject.js')
| -rw-r--r-- | src/components/map/elements/TileObject.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/components/map/elements/TileObject.js b/src/components/map/elements/TileObject.js new file mode 100644 index 00000000..8703011c --- /dev/null +++ b/src/components/map/elements/TileObject.js @@ -0,0 +1,25 @@ +import PropTypes from "prop-types"; +import React from "react"; +import {Rect} from "react-konva"; +import {OBJECT_BORDER_COLOR, ROOM_DEFAULT_COLOR} from "../../../colors/index"; +import Shapes from "../../../shapes/index"; +import {OBJECT_BORDER_WIDTH_IN_PIXELS, OBJECT_MARGIN_IN_PIXELS} from "../MapConstants"; + +const TileObject = ({tile, color}) => ( + <Rect + x={tile.positionX * TILE_SIZE_IN_PIXELS + OBJECT_MARGIN_IN_PIXELS} + y={tile.positionY * TILE_SIZE_IN_PIXELS + OBJECT_MARGIN_IN_PIXELS} + width={TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS * 2} + height={TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS * 2} + fill={ROOM_DEFAULT_COLOR} + stroke={OBJECT_BORDER_COLOR} + strokeWidth={OBJECT_BORDER_WIDTH_IN_PIXELS} + /> +); + +TileObject.propTypes = { + tile: Shapes.Tile, + color: PropTypes.string.isRequired, +}; + +export default TileObject; |
