Moving current location (and navigate) during track recording.

This commit is contained in:
Eric van der Vlist 2022-12-17 16:08:18 +01:00
parent f2f55a22bd
commit 70154a0f5a
1 changed files with 9 additions and 0 deletions

View File

@ -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}`
);
}
};