summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/map/elements/RackFillBar.js
diff options
context:
space:
mode:
authorjc0b <j@jc0b.computer>2020-07-22 16:28:47 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:21 +0200
commitd7469b9ebb01cf36a78cc98aab31fa8f307c4f65 (patch)
treed0535fa0cfe95001302fbd2b0d046d51caab6ffd /frontend/src/components/app/map/elements/RackFillBar.js
parent67b6ec800df8e023efadb60ae5f7919030b19789 (diff)
parent9e7cb3bd367607b32e102c3a87b68b33c53dec46 (diff)
Merge branch 'master' onto working copy
Diffstat (limited to 'frontend/src/components/app/map/elements/RackFillBar.js')
-rw-r--r--frontend/src/components/app/map/elements/RackFillBar.js35
1 files changed, 7 insertions, 28 deletions
diff --git a/frontend/src/components/app/map/elements/RackFillBar.js b/frontend/src/components/app/map/elements/RackFillBar.js
index 6e56e059..8c573a6f 100644
--- a/frontend/src/components/app/map/elements/RackFillBar.js
+++ b/frontend/src/components/app/map/elements/RackFillBar.js
@@ -21,27 +21,14 @@ const RackFillBar = ({ positionX, positionY, type, fillFraction }) => {
const x =
positionX * TILE_SIZE_IN_PIXELS +
OBJECT_MARGIN_IN_PIXELS +
- (type === 'space'
- ? halfOfObjectBorderWidth
- : 0.5 * (TILE_SIZE_IN_PIXELS - 2 * OBJECT_MARGIN_IN_PIXELS))
- const startY =
- positionY * TILE_SIZE_IN_PIXELS +
- OBJECT_MARGIN_IN_PIXELS +
- halfOfObjectBorderWidth
- const width =
- 0.5 * (TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS * 2) -
- halfOfObjectBorderWidth
- const fullHeight =
- TILE_SIZE_IN_PIXELS -
- OBJECT_MARGIN_IN_PIXELS * 2 -
- OBJECT_BORDER_WIDTH_IN_PIXELS
+ (type === 'space' ? halfOfObjectBorderWidth : 0.5 * (TILE_SIZE_IN_PIXELS - 2 * OBJECT_MARGIN_IN_PIXELS))
+ const startY = positionY * TILE_SIZE_IN_PIXELS + OBJECT_MARGIN_IN_PIXELS + halfOfObjectBorderWidth
+ const width = 0.5 * (TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS * 2) - halfOfObjectBorderWidth
+ const fullHeight = TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS * 2 - OBJECT_BORDER_WIDTH_IN_PIXELS
const fractionHeight = fillFraction * fullHeight
const fractionY =
- (positionY + 1) * TILE_SIZE_IN_PIXELS -
- OBJECT_MARGIN_IN_PIXELS -
- halfOfObjectBorderWidth -
- fractionHeight
+ (positionY + 1) * TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS - halfOfObjectBorderWidth - fractionHeight
return (
<Group>
@@ -50,22 +37,14 @@ const RackFillBar = ({ positionX, positionY, type, fillFraction }) => {
y={startY}
width={width}
height={fullHeight}
- fill={
- type === 'space'
- ? RACK_SPACE_BAR_BACKGROUND_COLOR
- : RACK_ENERGY_BAR_BACKGROUND_COLOR
- }
+ fill={type === 'space' ? RACK_SPACE_BAR_BACKGROUND_COLOR : RACK_ENERGY_BAR_BACKGROUND_COLOR}
/>
<Rect
x={x}
y={fractionY}
width={width}
height={fractionHeight}
- fill={
- type === 'space'
- ? RACK_SPACE_BAR_FILL_COLOR
- : RACK_ENERGY_BAR_FILL_COLOR
- }
+ fill={type === 'space' ? RACK_SPACE_BAR_FILL_COLOR : RACK_ENERGY_BAR_FILL_COLOR}
/>
<ImageComponent
src={'/img/topology/rack-' + type + '-icon.png'}