Make sure an initial GPS-fix is passed along as well

This commit is contained in:
Pieter Vander Vennet 2022-12-23 14:22:52 +01:00
parent 4de76136de
commit dff270fc13

View file

@ -117,19 +117,14 @@ export default class GeoLocationHandler {
private CopyGeolocationIntoMapstate() { private CopyGeolocationIntoMapstate() {
const state = this._state const state = this._state
this.geolocationState.currentGPSLocation.addCallback((location) => { this.geolocationState.currentGPSLocation.addCallbackAndRunD((location) => {
const feature = { const feature = {
type: "Feature", type: "Feature",
properties: <GeoLocationPointProperties>{ properties: <GeoLocationPointProperties>{
id: "gps", id: "gps",
"user:location": "yes", "user:location": "yes",
date: new Date().toISOString(), date: new Date().toISOString(),
latitude: location.latitude, ...location,
longitude: location.longitude,
speed: location.speed,
accuracy: location.accuracy,
heading: location.heading,
altitude: location.altitude,
}, },
geometry: { geometry: {
type: "Point", type: "Point",