diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-22 10:48:01 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:44 +0200 |
| commit | 602c3eb9327a3681f5a220e13b8291bb60643cd7 (patch) | |
| tree | 08bbcad1460419af12c59ecf60d102af161bf57f /src/components/map/elements/TileObject.js | |
| parent | 193e7b32d5e3d356021a5bb8f777fec3bdc413e7 (diff) | |
Add tile rendering logic
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; |
