diff options
Diffstat (limited to 'modern/src/map/main/MapLiveRoutes.js')
-rw-r--r-- | modern/src/map/main/MapLiveRoutes.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modern/src/map/main/MapLiveRoutes.js b/modern/src/map/main/MapLiveRoutes.js index fc1a1dde..e98bea74 100644 --- a/modern/src/map/main/MapLiveRoutes.js +++ b/modern/src/map/main/MapLiveRoutes.js @@ -4,12 +4,15 @@ import { useSelector } from 'react-redux'; import { useTheme } from '@mui/styles'; import { map } from '../core/MapView'; import { usePrevious } from '../../reactHelper'; +import { useAttributePreference } from '../../common/util/preferences'; const MapLiveRoutes = () => { const id = 'liveRoute'; const theme = useTheme(); + const liveRouteLength = useAttributePreference('web.liveRouteLength', 10); + const selectedDeviceId = useSelector((state) => state.devices.selectedId); const currentDeviceId = usePrevious(selectedDeviceId); @@ -62,7 +65,7 @@ const MapLiveRoutes = () => { } else if (position) { const last = route.at(-1); if (!last || (last.latitude !== position.latitude && last.longitude !== position.longitude)) { - setRoute([...route.slice(-9), position]); + setRoute([...route.slice(1 - liveRouteLength), position]); } } }, [selectedDeviceId, currentDeviceId, position, route]); |