Fix: re-enable speed and heading in GPS-cursor

This commit is contained in:
Pieter Vander Vennet 2023-11-23 17:07:53 +01:00
parent ce1855b2bd
commit ff47d75d41
3 changed files with 9 additions and 30 deletions

View file

@ -137,7 +137,6 @@ export default class GeoLocationHandler {
}
}
console.trace("Moving the map to the GPS-location")
mapLocation.setData({
lon: newLocation.longitude,
lat: newLocation.latitude,
@ -152,7 +151,6 @@ export default class GeoLocationHandler {
private CopyGeolocationIntoMapstate() {
const features: UIEventSource<Feature[]> = new UIEventSource<Feature[]>([])
this.currentUserLocation = new StaticFeatureSource(features)
const keysToCopy = ["speed", "accuracy", "altitude", "altitudeAccuracy", "heading"]
let i = 0
this.geolocationState.currentGPSLocation.addCallbackAndRun((location) => {
if (location === undefined) {
@ -163,19 +161,15 @@ export default class GeoLocationHandler {
id: "gps-" + i,
"user:location": "yes",
date: new Date().toISOString(),
// GeolocationObject behaves really weird when indexing, so copying it one by one is the most stable
accuracy: location.accuracy,
speed: location.speed,
altitude: location.altitude,
altitudeAccuracy: location.altitudeAccuracy,
heading: location.heading,
}
i++
for (const k in keysToCopy) {
// For some weird reason, the 'Object.keys' method doesn't work for the 'location: GeolocationCoordinates'-object and will thus not copy all the properties when using {...location}
// As such, they are copied here
if (location[k]) {
properties[k] = location[k]
}
}
console.debug("Current location object:", location)
properties["_all"] = JSON.stringify(location)
const feature = <Feature>{
type: "Feature",
properties,
@ -184,7 +178,6 @@ export default class GeoLocationHandler {
coordinates: [location.longitude, location.latitude],
},
}
features.setData([feature])
})
}

View file

@ -9,6 +9,7 @@
import Lazy from "../Base/Lazy"
import BaseUIElement from "../BaseUIElement"
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
import { VariableUiElement } from "../Base/VariableUIElement";
//Svelte props
export let tags: UIEventSource<any>
@ -54,13 +55,7 @@
return parts
})
let _allTags = []
onDestroy(
allTags.addCallbackAndRunD((allTags) => {
_allTags = allTags
})
)
const tagsTable = new Table(["Key", "Value"], _allTags).SetClass("zebra-table break-all")
const tagsTable = new VariableUiElement(allTags.mapD(_allTags => new Table(["Key", "Value"], _allTags).SetClass("zebra-table break-all")))
</script>
<section>

View file

@ -1,15 +1,6 @@
<script lang="ts">
// Testing grounds
import LanguagePicker from "./InputElement/LanguagePicker.svelte";
import Translations from "./i18n/Translations";
import Tr from "./Base/Tr.svelte";
import Locale from "./i18n/Locale";
let language = Locale.language
</script>
<div class="w-full">
<LanguagePicker preferredLanguages={["nl", "en"]}/>
<Tr t={Translations.t.general.download.downloadAsPdf}/>
{$language}
No tests
</div>