aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/main/MapAccuracy.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/modern/src/map/main/MapAccuracy.js b/modern/src/map/main/MapAccuracy.js
index bec8bde8..335be58e 100644
--- a/modern/src/map/main/MapAccuracy.js
+++ b/modern/src/map/main/MapAccuracy.js
@@ -1,21 +1,13 @@
import { useId, useEffect } from 'react';
-import { useSelector } from 'react-redux';
import circle from '@turf/circle';
import { useTheme } from '@mui/styles';
import { map } from '../core/MapView';
-const MapAccuracy = () => {
+const MapAccuracy = ({ positions }) => {
const id = useId();
const theme = useTheme();
- const positions = useSelector((state) => ({
- type: 'FeatureCollection',
- features: Object.values(state.positions.items)
- .filter((position) => position.accuracy > 0)
- .map((position) => circle([position.longitude, position.latitude], position.accuracy * 0.001)),
- }));
-
useEffect(() => {
map.addSource(id, {
type: 'geojson',
@@ -50,7 +42,13 @@ const MapAccuracy = () => {
}, []);
useEffect(() => {
- map.getSource(id).setData(positions);
+ const data = {
+ type: 'FeatureCollection',
+ features: positions
+ .filter((position) => position.accuracy > 0)
+ .map((position) => circle([position.longitude, position.latitude], position.accuracy * 0.001)),
+ };
+ map.getSource(id).setData(data);
}, [positions]);
return null;