From ff47d75d41fc1fd4f576cd483150fe27cb3942d3 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 23 Nov 2023 17:07:53 +0100 Subject: [PATCH] Fix: re-enable speed and heading in GPS-cursor --- src/Logic/Actors/GeoLocationHandler.ts | 19 ++++++------------- src/UI/Popup/AllTagsPanel.svelte | 9 ++------- src/UI/Test.svelte | 11 +---------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/src/Logic/Actors/GeoLocationHandler.ts b/src/Logic/Actors/GeoLocationHandler.ts index 9333a84134..68efc803d9 100644 --- a/src/Logic/Actors/GeoLocationHandler.ts +++ b/src/Logic/Actors/GeoLocationHandler.ts @@ -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 = new UIEventSource([]) 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 = { type: "Feature", properties, @@ -184,7 +178,6 @@ export default class GeoLocationHandler { coordinates: [location.longitude, location.latitude], }, } - features.setData([feature]) }) } diff --git a/src/UI/Popup/AllTagsPanel.svelte b/src/UI/Popup/AllTagsPanel.svelte index 81bc9219e3..9913416fbb 100644 --- a/src/UI/Popup/AllTagsPanel.svelte +++ b/src/UI/Popup/AllTagsPanel.svelte @@ -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 @@ -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")))
diff --git a/src/UI/Test.svelte b/src/UI/Test.svelte index 22f2d9313d..1b51c34bf6 100644 --- a/src/UI/Test.svelte +++ b/src/UI/Test.svelte @@ -1,15 +1,6 @@ -
- - - - {$language} + No tests