diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-04 09:10:46 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:57 +0200 |
| commit | 6f3afd0317a8e549f77ad6764f6dbe4d4953b67c (patch) | |
| tree | 767379e013d56b87ac814327f6fc4d789c23947e /src/components/map/elements/TilePlusIcon.js | |
| parent | f4389bd0df1669969339b8b43b61fb78e7c1be25 (diff) | |
Add plus icon component
Diffstat (limited to 'src/components/map/elements/TilePlusIcon.js')
| -rw-r--r-- | src/components/map/elements/TilePlusIcon.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/components/map/elements/TilePlusIcon.js b/src/components/map/elements/TilePlusIcon.js new file mode 100644 index 00000000..3cc3178c --- /dev/null +++ b/src/components/map/elements/TilePlusIcon.js @@ -0,0 +1,40 @@ +import React from "react"; +import {Group, Line} from "react-konva"; +import {TILE_PLUS_COLOR} from "../../../colors/index"; +import Shapes from "../../../shapes/index"; +import {TILE_PLUS_WIDTH_IN_PIXELS, TILE_SIZE_IN_PIXELS} from "../MapConstants"; + +const TilePlusIcon = ({positionX, positionY}) => { + const linePoints = [ + [ + (positionX + 0.5) * TILE_SIZE_IN_PIXELS, + positionY * TILE_SIZE_IN_PIXELS + OBJECT_MARGIN_IN_PIXELS, + (positionX + 0.5) * TILE_SIZE_IN_PIXELS, + (positionY + 1) * TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS, + ], + [ + positionX * TILE_SIZE_IN_PIXELS + OBJECT_MARGIN_IN_PIXELS, + (positionY + 0.5) * TILE_SIZE_IN_PIXELS, + (positionX + 1) * TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS, + (positionY + 0.5) * TILE_SIZE_IN_PIXELS, + ], + ]; + return ( + <Group> + {linePoints.map(points => ( + <Line + points={points} + lineCap="round" + stroke={TILE_PLUS_COLOR} + strokeWidth={TILE_PLUS_WIDTH_IN_PIXELS} + /> + ))} + </Group> + ) +}; + +TilePlusIcon.propTypes = { + wallSegment: Shapes.WallSegment, +}; + +export default TilePlusIcon; |
