From 8f5e6d1e73f16e3cdd523f961d06e4b4eb5a8cef Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 25 Aug 2017 21:10:40 +0200 Subject: Implement wall drawing --- src/components/map/elements/WallSegment.js | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/components/map/elements/WallSegment.js (limited to 'src/components/map/elements/WallSegment.js') diff --git a/src/components/map/elements/WallSegment.js b/src/components/map/elements/WallSegment.js new file mode 100644 index 00000000..ed3627bb --- /dev/null +++ b/src/components/map/elements/WallSegment.js @@ -0,0 +1,39 @@ +import React from "react"; +import {Line} from "react-konva"; +import {WALL_COLOR} from "../../../colors/index"; +import Shapes from "../../../shapes/index"; +import {TILE_SIZE_IN_PIXELS, WALL_WIDTH_IN_PIXELS} from "../MapConstants"; + +const WallSegment = ({wallSegment}) => { + let points; + if (wallSegment.isHorizontal) { + points = [ + wallSegment.startPosX * TILE_SIZE_IN_PIXELS, + wallSegment.startPosY * TILE_SIZE_IN_PIXELS, + (wallSegment.startPosX + wallSegment.length) * TILE_SIZE_IN_PIXELS, + wallSegment.startPosY * TILE_SIZE_IN_PIXELS + ]; + } else { + points = [ + wallSegment.startPosX * TILE_SIZE_IN_PIXELS, + wallSegment.startPosY * TILE_SIZE_IN_PIXELS, + wallSegment.startPosX * TILE_SIZE_IN_PIXELS, + (wallSegment.startPosY + wallSegment.length) * TILE_SIZE_IN_PIXELS, + ]; + } + + return ( + + ) +}; + +WallSegment.propTypes = { + wallSegment: Shapes.WallSegment, +}; + +export default WallSegment; -- cgit v1.2.3