summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/map/layers
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-25 16:01:14 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-25 16:01:14 +0200
commitcd0b45627f0d8da8c8dc4edde223f3c36e9bcfbf (patch)
tree6ae1681630a0e270c23804e6dbb3bd414ebe5d6e /frontend/src/components/app/map/layers
parent128a1db017545597a5c035b7960eb3fd36b5f987 (diff)
build: Migrate to flat project structure
This change updates the project structure to become flattened. Previously, the simulator, frontend and API each lived into their own directory. With this change, all modules of the project live in the top-level directory of the repository. This should improve discoverability of modules of the project.
Diffstat (limited to 'frontend/src/components/app/map/layers')
-rw-r--r--frontend/src/components/app/map/layers/HoverLayerComponent.js75
-rw-r--r--frontend/src/components/app/map/layers/MapLayerComponent.js17
-rw-r--r--frontend/src/components/app/map/layers/ObjectHoverLayerComponent.js11
-rw-r--r--frontend/src/components/app/map/layers/RoomHoverLayerComponent.js6
4 files changed, 0 insertions, 109 deletions
diff --git a/frontend/src/components/app/map/layers/HoverLayerComponent.js b/frontend/src/components/app/map/layers/HoverLayerComponent.js
deleted file mode 100644
index bead87de..00000000
--- a/frontend/src/components/app/map/layers/HoverLayerComponent.js
+++ /dev/null
@@ -1,75 +0,0 @@
-import PropTypes from 'prop-types'
-import React from 'react'
-import { Layer } from 'react-konva'
-import HoverTile from '../elements/HoverTile'
-import { TILE_SIZE_IN_PIXELS } from '../MapConstants'
-
-class HoverLayerComponent extends React.Component {
- static propTypes = {
- mouseX: PropTypes.number.isRequired,
- mouseY: PropTypes.number.isRequired,
- mapPosition: PropTypes.object.isRequired,
- mapScale: PropTypes.number.isRequired,
- isEnabled: PropTypes.func.isRequired,
- onClick: PropTypes.func.isRequired,
- }
-
- state = {
- positionX: -1,
- positionY: -1,
- validity: false,
- }
-
- componentDidUpdate() {
- if (!this.props.isEnabled()) {
- return
- }
-
- const positionX = Math.floor(
- (this.props.mouseX - this.props.mapPosition.x) / (this.props.mapScale * TILE_SIZE_IN_PIXELS)
- )
- const positionY = Math.floor(
- (this.props.mouseY - this.props.mapPosition.y) / (this.props.mapScale * TILE_SIZE_IN_PIXELS)
- )
-
- if (positionX !== this.state.positionX || positionY !== this.state.positionY) {
- this.setState({
- positionX,
- positionY,
- validity: this.props.isValid(positionX, positionY),
- })
- }
- }
-
- render() {
- if (!this.props.isEnabled()) {
- return <Layer />
- }
-
- const pixelX = this.props.mapScale * this.state.positionX * TILE_SIZE_IN_PIXELS + this.props.mapPosition.x
- const pixelY = this.props.mapScale * this.state.positionY * TILE_SIZE_IN_PIXELS + this.props.mapPosition.y
-
- return (
- <Layer opacity={0.6}>
- <HoverTile
- pixelX={pixelX}
- pixelY={pixelY}
- scale={this.props.mapScale}
- isValid={this.state.validity}
- onClick={() =>
- this.state.validity ? this.props.onClick(this.state.positionX, this.state.positionY) : undefined
- }
- />
- {this.props.children
- ? React.cloneElement(this.props.children, {
- pixelX,
- pixelY,
- scale: this.props.mapScale,
- })
- : undefined}
- </Layer>
- )
- }
-}
-
-export default HoverLayerComponent
diff --git a/frontend/src/components/app/map/layers/MapLayerComponent.js b/frontend/src/components/app/map/layers/MapLayerComponent.js
deleted file mode 100644
index 8ee14c9c..00000000
--- a/frontend/src/components/app/map/layers/MapLayerComponent.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import React from 'react'
-import { Group, Layer } from 'react-konva'
-import TopologyContainer from '../../../../containers/app/map/TopologyContainer'
-import Backdrop from '../elements/Backdrop'
-import GridGroup from '../groups/GridGroup'
-
-const MapLayerComponent = ({ mapPosition, mapScale }) => (
- <Layer>
- <Group x={mapPosition.x} y={mapPosition.y} scaleX={mapScale} scaleY={mapScale}>
- <Backdrop />
- <TopologyContainer />
- <GridGroup />
- </Group>
- </Layer>
-)
-
-export default MapLayerComponent
diff --git a/frontend/src/components/app/map/layers/ObjectHoverLayerComponent.js b/frontend/src/components/app/map/layers/ObjectHoverLayerComponent.js
deleted file mode 100644
index 661fc255..00000000
--- a/frontend/src/components/app/map/layers/ObjectHoverLayerComponent.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react'
-import TilePlusIcon from '../elements/TilePlusIcon'
-import HoverLayerComponent from './HoverLayerComponent'
-
-const ObjectHoverLayerComponent = (props) => (
- <HoverLayerComponent {...props}>
- <TilePlusIcon {...props} />
- </HoverLayerComponent>
-)
-
-export default ObjectHoverLayerComponent
diff --git a/frontend/src/components/app/map/layers/RoomHoverLayerComponent.js b/frontend/src/components/app/map/layers/RoomHoverLayerComponent.js
deleted file mode 100644
index 887e2891..00000000
--- a/frontend/src/components/app/map/layers/RoomHoverLayerComponent.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import React from 'react'
-import HoverLayerComponent from './HoverLayerComponent'
-
-const RoomHoverLayerComponent = (props) => <HoverLayerComponent {...props} />
-
-export default RoomHoverLayerComponent