Skip to content

Commit 36c3946

Browse files
committed
more desriptive names
1 parent 7198b67 commit 36c3946

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/layers/UseCurrentLocationLayer.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { fromLonLat } from 'ol/proj'
99

1010
export default function useCurrentLocationLayer(map: Map, locationState: CurrentLocationStoreState) {
1111
const layerRef = useRef<VectorLayer<VectorSource> | null>(null)
12-
const posFeatureRef = useRef<Feature | null>(null)
13-
const accFeatureRef = useRef<Feature | null>(null)
12+
const positionFeatureRef = useRef<Feature | null>(null)
13+
const accuracyFeatureRef = useRef<Feature | null>(null)
1414
const headingFeatureRef = useRef<Feature | null>(null)
1515

1616
// Create layer once when enabled
@@ -19,8 +19,8 @@ export default function useCurrentLocationLayer(map: Map, locationState: Current
1919
if (layerRef.current) {
2020
map.removeLayer(layerRef.current)
2121
layerRef.current = null
22-
posFeatureRef.current = null
23-
accFeatureRef.current = null
22+
positionFeatureRef.current = null
23+
accuracyFeatureRef.current = null
2424
headingFeatureRef.current = null
2525
}
2626
return
@@ -35,17 +35,17 @@ export default function useCurrentLocationLayer(map: Map, locationState: Current
3535
map.addLayer(layer)
3636

3737
layerRef.current = layer
38-
posFeatureRef.current = positionFeature
39-
accFeatureRef.current = accuracyFeature
38+
positionFeatureRef.current = positionFeature
39+
accuracyFeatureRef.current = accuracyFeature
4040
headingFeatureRef.current = headingFeature
4141
}
4242

4343
return () => {
4444
if (layerRef.current) {
4545
map.removeLayer(layerRef.current)
4646
layerRef.current = null
47-
posFeatureRef.current = null
48-
accFeatureRef.current = null
47+
positionFeatureRef.current = null
48+
accuracyFeatureRef.current = null
4949
headingFeatureRef.current = null
5050
}
5151
}
@@ -55,15 +55,15 @@ export default function useCurrentLocationLayer(map: Map, locationState: Current
5555
if (
5656
!locationState.enabled ||
5757
!locationState.coordinate ||
58-
!posFeatureRef.current ||
59-
!accFeatureRef.current ||
58+
!positionFeatureRef.current ||
59+
!accuracyFeatureRef.current ||
6060
!headingFeatureRef.current
6161
)
6262
return
6363

6464
const coord = fromLonLat([locationState.coordinate.lng, locationState.coordinate.lat])
65-
posFeatureRef.current.setGeometry(new Point(coord))
66-
accFeatureRef.current.setGeometry(new Circle(coord, locationState.accuracy))
65+
positionFeatureRef.current.setGeometry(new Point(coord))
66+
accuracyFeatureRef.current.setGeometry(new Circle(coord, locationState.accuracy))
6767

6868
// Set heading feature position (style will handle the triangle and rotation)
6969
if (locationState.heading != null) {

0 commit comments

Comments
 (0)