From 70154a0f5ad4dc317adef2fbcce39dbac5400654 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sat, 17 Dec 2022 16:08:18 +0100 Subject: [PATCH] Moving current location (and navigate) during track recording. --- src/components/gpx-record/GpxRecord.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/gpx-record/GpxRecord.tsx b/src/components/gpx-record/GpxRecord.tsx index 3e04200..564ae50 100644 --- a/src/components/gpx-record/GpxRecord.tsx +++ b/src/components/gpx-record/GpxRecord.tsx @@ -19,6 +19,9 @@ import { import dispatch from '../../workers/dispatcher-main'; import { emptyTrk } from '../../db/trk'; import getUri from '../../lib/ids'; +import { setCurrentLocation } from '../get-location/GetLocation'; +import { getState } from '../map'; +import { useNavigate } from '@solidjs/router'; declare global { var $lastValidLocationTime: number; @@ -26,6 +29,7 @@ declare global { const GpxRecord: Component<{}> = (props) => { const [t] = useI18n(); + const navigate = useNavigate(); const [state, setState] = createSignal('stopped'); const [open, setOpen] = createSignal(false); const [watcherId, setWatcherId] = createSignal(); @@ -58,6 +62,11 @@ const GpxRecord: Component<{}> = (props) => { }, }, }); + setCurrentLocation({lon:location.longitude, lat:location.latitude}); + const state = getState(); + navigate( + `/map/${state.provider}/${location.longitude}/${location.latitude}/${state.zoom}/${state.rotation}` + ); } };