Skip to content

Commit 53732c6

Browse files
committed
fixing layerSelector and trail dots issue
1 parent 4062f8e commit 53732c6

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if (process.env.REACT_APP_PUBLISHABLE_KEY) {
5656
>
5757
<LiveView
5858
onDeviceClick={console.log}
59-
navigateOnClick={false}
59+
navigateOnClick={true}
6060
publishableKey={process.env.REACT_APP_PUBLISHABLE_KEY}
6161
showTooltips={false}
6262
showDeviceList={true}

src/pages/AccountLiveLocation/components/LayerSelector/LayerSelector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ const LayerSelector = ({
3737
useEffect(() => {
3838
document.addEventListener('mousedown', handleClick, false)
3939
return () => document.removeEventListener('mousedown', handleClick, false)
40-
}, [])
40+
}, []) // eslint-disable-line
4141

4242
const layerSelectorEl = useRef(null)
4343

4444
return (
4545
<div
46+
ref={layerSelectorEl}
4647
className={classNames(styles.LayerSelectorContainer, {
4748
[styles.active]: showMenu
4849
})}

src/pages/Generic/Map/index.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,18 @@ const MapContainer = props => {
104104

105105
// This effect initilizes/updates/manages accuracy halo
106106
const haloRef = useRef(null)
107-
React.useEffect(
108-
() => {
109-
if (mapRef && mapRef.current && accuracy) {
110-
if (haloRef && haloRef.current) haloRef.current.remove()
111-
haloRef.current = Leaflet.circle(markerPosition, {
112-
radius: accuracy,
113-
fillColor: constants.map.colors.activeColor,
114-
stroke: false
115-
}).addTo(mapRef.current)
116-
} else {
117-
if (haloRef.current) haloRef.current.remove()
118-
}
119-
},
120-
[accuracy, markerPosition]
121-
)
107+
React.useEffect(() => {
108+
if (mapRef && mapRef.current && accuracy) {
109+
if (haloRef && haloRef.current) haloRef.current.remove()
110+
haloRef.current = Leaflet.circle(markerPosition, {
111+
radius: accuracy,
112+
fillColor: constants.map.colors.activeColor,
113+
stroke: false
114+
}).addTo(mapRef.current)
115+
} else {
116+
if (haloRef.current) haloRef.current.remove()
117+
}
118+
}, [accuracy, markerPosition])
122119

123120
// This effect initilizes/updates/manages trail
124121
const trailRef = useRef(null)
@@ -131,12 +128,12 @@ const MapContainer = props => {
131128
html
132129
})
133130
if (trailRef && trailRef.current) trailRef.current.clearLayers()
134-
const trailPoints = trail.map(trailElement =>
135-
Leaflet.marker(trailElement.coordinates, { icon })
136-
)
131+
const trailPoints = trail.map(trailElement => {
132+
return Leaflet.marker(trailElement.geometry.coordinates, { icon })
133+
})
137134
const trailLinePoints = [
138135
markerPosition || center,
139-
...trail.map(trailElement => trailElement.coordinates)
136+
...trail.map(trailElement => trailElement.geometry.coordinates)
140137
]
141138
const trailLine = Leaflet.polyline(trailLinePoints, {
142139
color: constants.map.colors.activeColor,

src/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function reducer(state, action) {
2020
return { selectedLayer: action.data, name: 'custom' }
2121
default:
2222
console.log('error')
23-
return CONSTANTS.tileLayers['base']
23+
return state
2424
}
2525
}
2626

0 commit comments

Comments
 (0)