summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/app/map/elements
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/app/map/elements')
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/elements/HoverTile.js12
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/elements/RackFillBar.js2
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/elements/TilePlusIcon.js26
3 files changed, 20 insertions, 20 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/elements/HoverTile.js b/opendc-web/opendc-web-ui/src/components/app/map/elements/HoverTile.js
index 11bba0e1..0369bb79 100644
--- a/opendc-web/opendc-web-ui/src/components/app/map/elements/HoverTile.js
+++ b/opendc-web/opendc-web-ui/src/components/app/map/elements/HoverTile.js
@@ -4,10 +4,10 @@ import { Rect } from 'react-konva'
import { ROOM_HOVER_INVALID_COLOR, ROOM_HOVER_VALID_COLOR } from '../../../../util/colors'
import { TILE_SIZE_IN_PIXELS } from '../MapConstants'
-const HoverTile = ({ pixelX, pixelY, isValid, scale, onClick }) => (
+const HoverTile = ({ x, y, isValid, scale = 1, onClick }) => (
<Rect
- x={pixelX}
- y={pixelY}
+ x={x}
+ y={y}
scaleX={scale}
scaleY={scale}
width={TILE_SIZE_IN_PIXELS}
@@ -18,10 +18,10 @@ const HoverTile = ({ pixelX, pixelY, isValid, scale, onClick }) => (
)
HoverTile.propTypes = {
- pixelX: PropTypes.number.isRequired,
- pixelY: PropTypes.number.isRequired,
+ x: PropTypes.number.isRequired,
+ y: PropTypes.number.isRequired,
isValid: PropTypes.bool.isRequired,
- scale: PropTypes.number.isRequired,
+ scale: PropTypes.number,
onClick: PropTypes.func.isRequired,
}
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/elements/RackFillBar.js b/opendc-web/opendc-web-ui/src/components/app/map/elements/RackFillBar.js
index 8c573a6f..aa284944 100644
--- a/opendc-web/opendc-web-ui/src/components/app/map/elements/RackFillBar.js
+++ b/opendc-web/opendc-web-ui/src/components/app/map/elements/RackFillBar.js
@@ -16,7 +16,7 @@ import {
} from '../MapConstants'
import ImageComponent from './ImageComponent'
-const RackFillBar = ({ positionX, positionY, type, fillFraction }) => {
+function RackFillBar({ positionX, positionY, type, fillFraction }) {
const halfOfObjectBorderWidth = OBJECT_BORDER_WIDTH_IN_PIXELS / 2
const x =
positionX * TILE_SIZE_IN_PIXELS +
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/elements/TilePlusIcon.js b/opendc-web/opendc-web-ui/src/components/app/map/elements/TilePlusIcon.js
index be3a00a8..186c2b3a 100644
--- a/opendc-web/opendc-web-ui/src/components/app/map/elements/TilePlusIcon.js
+++ b/opendc-web/opendc-web-ui/src/components/app/map/elements/TilePlusIcon.js
@@ -4,19 +4,19 @@ import { Group, Line } from 'react-konva'
import { TILE_PLUS_COLOR } from '../../../../util/colors'
import { TILE_PLUS_MARGIN_IN_PIXELS, TILE_PLUS_WIDTH_IN_PIXELS, TILE_SIZE_IN_PIXELS } from '../MapConstants'
-const TilePlusIcon = ({ pixelX, pixelY, mapScale }) => {
+function TilePlusIcon({ x, y, scale = 1 }) {
const linePoints = [
[
- pixelX + 0.5 * TILE_SIZE_IN_PIXELS * mapScale,
- pixelY + TILE_PLUS_MARGIN_IN_PIXELS * mapScale,
- pixelX + 0.5 * TILE_SIZE_IN_PIXELS * mapScale,
- pixelY + TILE_SIZE_IN_PIXELS * mapScale - TILE_PLUS_MARGIN_IN_PIXELS * mapScale,
+ x + 0.5 * TILE_SIZE_IN_PIXELS * scale,
+ y + TILE_PLUS_MARGIN_IN_PIXELS * scale,
+ x + 0.5 * TILE_SIZE_IN_PIXELS * scale,
+ y + TILE_SIZE_IN_PIXELS * scale - TILE_PLUS_MARGIN_IN_PIXELS * scale,
],
[
- pixelX + TILE_PLUS_MARGIN_IN_PIXELS * mapScale,
- pixelY + 0.5 * TILE_SIZE_IN_PIXELS * mapScale,
- pixelX + TILE_SIZE_IN_PIXELS * mapScale - TILE_PLUS_MARGIN_IN_PIXELS * mapScale,
- pixelY + 0.5 * TILE_SIZE_IN_PIXELS * mapScale,
+ x + TILE_PLUS_MARGIN_IN_PIXELS * scale,
+ y + 0.5 * TILE_SIZE_IN_PIXELS * scale,
+ x + TILE_SIZE_IN_PIXELS * scale - TILE_PLUS_MARGIN_IN_PIXELS * scale,
+ y + 0.5 * TILE_SIZE_IN_PIXELS * scale,
],
]
return (
@@ -27,7 +27,7 @@ const TilePlusIcon = ({ pixelX, pixelY, mapScale }) => {
points={points}
lineCap="round"
stroke={TILE_PLUS_COLOR}
- strokeWidth={TILE_PLUS_WIDTH_IN_PIXELS * mapScale}
+ strokeWidth={TILE_PLUS_WIDTH_IN_PIXELS * scale}
listening={false}
/>
))}
@@ -36,9 +36,9 @@ const TilePlusIcon = ({ pixelX, pixelY, mapScale }) => {
}
TilePlusIcon.propTypes = {
- pixelX: PropTypes.number,
- pixelY: PropTypes.number,
- mapScale: PropTypes.number,
+ x: PropTypes.number,
+ y: PropTypes.number,
+ scale: PropTypes.number,
}
export default TilePlusIcon