Moving current location (and navigate) during track recording.
This commit is contained in:
parent
f2f55a22bd
commit
70154a0f5a
|
@ -19,6 +19,9 @@ import {
|
||||||
import dispatch from '../../workers/dispatcher-main';
|
import dispatch from '../../workers/dispatcher-main';
|
||||||
import { emptyTrk } from '../../db/trk';
|
import { emptyTrk } from '../../db/trk';
|
||||||
import getUri from '../../lib/ids';
|
import getUri from '../../lib/ids';
|
||||||
|
import { setCurrentLocation } from '../get-location/GetLocation';
|
||||||
|
import { getState } from '../map';
|
||||||
|
import { useNavigate } from '@solidjs/router';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
var $lastValidLocationTime: number;
|
var $lastValidLocationTime: number;
|
||||||
|
@ -26,6 +29,7 @@ declare global {
|
||||||
|
|
||||||
const GpxRecord: Component<{}> = (props) => {
|
const GpxRecord: Component<{}> = (props) => {
|
||||||
const [t] = useI18n();
|
const [t] = useI18n();
|
||||||
|
const navigate = useNavigate();
|
||||||
const [state, setState] = createSignal('stopped');
|
const [state, setState] = createSignal('stopped');
|
||||||
const [open, setOpen] = createSignal(false);
|
const [open, setOpen] = createSignal(false);
|
||||||
const [watcherId, setWatcherId] = createSignal();
|
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}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue