summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/map/layers/HoverLayerComponent.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/layers/HoverLayerComponent.js
parent67b6ec800df8e023efadb60ae5f7919030b19789 (diff)
parent9e7cb3bd367607b32e102c3a87b68b33c53dec46 (diff)
Merge branch 'master' onto working copy
Diffstat (limited to 'frontend/src/components/app/map/layers/HoverLayerComponent.js')
-rw-r--r--frontend/src/components/app/map/layers/HoverLayerComponent.js34
1 files changed, 12 insertions, 22 deletions
diff --git a/frontend/src/components/app/map/layers/HoverLayerComponent.js b/frontend/src/components/app/map/layers/HoverLayerComponent.js
index 25c9c412..bead87de 100644
--- a/frontend/src/components/app/map/layers/HoverLayerComponent.js
+++ b/frontend/src/components/app/map/layers/HoverLayerComponent.js
@@ -26,18 +26,13 @@ class HoverLayerComponent extends React.Component {
}
const positionX = Math.floor(
- (this.props.mouseX - this.props.mapPosition.x) /
- (this.props.mapScale * TILE_SIZE_IN_PIXELS),
+ (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),
+ (this.props.mouseY - this.props.mapPosition.y) / (this.props.mapScale * TILE_SIZE_IN_PIXELS)
)
- if (
- positionX !== this.state.positionX ||
- positionY !== this.state.positionY
- ) {
+ if (positionX !== this.state.positionX || positionY !== this.state.positionY) {
this.setState({
positionX,
positionY,
@@ -48,15 +43,11 @@ class HoverLayerComponent extends React.Component {
render() {
if (!this.props.isEnabled()) {
- return <Layer/>
+ 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
+ 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}>
@@ -66,16 +57,15 @@ class HoverLayerComponent extends React.Component {
scale={this.props.mapScale}
isValid={this.state.validity}
onClick={() =>
- this.state.validity
- ? this.props.onClick(this.state.positionX, this.state.positionY)
- : undefined}
+ 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,
- })
+ pixelX,
+ pixelY,
+ scale: this.props.mapScale,
+ })
: undefined}
</Layer>
)