forked from MapComplete/MapComplete
Fix: re-enable speed and heading in GPS-cursor
This commit is contained in:
parent
ce1855b2bd
commit
ff47d75d41
3 changed files with 9 additions and 30 deletions
|
@ -137,7 +137,6 @@ export default class GeoLocationHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.trace("Moving the map to the GPS-location")
|
|
||||||
mapLocation.setData({
|
mapLocation.setData({
|
||||||
lon: newLocation.longitude,
|
lon: newLocation.longitude,
|
||||||
lat: newLocation.latitude,
|
lat: newLocation.latitude,
|
||||||
|
@ -152,7 +151,6 @@ export default class GeoLocationHandler {
|
||||||
private CopyGeolocationIntoMapstate() {
|
private CopyGeolocationIntoMapstate() {
|
||||||
const features: UIEventSource<Feature[]> = new UIEventSource<Feature[]>([])
|
const features: UIEventSource<Feature[]> = new UIEventSource<Feature[]>([])
|
||||||
this.currentUserLocation = new StaticFeatureSource(features)
|
this.currentUserLocation = new StaticFeatureSource(features)
|
||||||
const keysToCopy = ["speed", "accuracy", "altitude", "altitudeAccuracy", "heading"]
|
|
||||||
let i = 0
|
let i = 0
|
||||||
this.geolocationState.currentGPSLocation.addCallbackAndRun((location) => {
|
this.geolocationState.currentGPSLocation.addCallbackAndRun((location) => {
|
||||||
if (location === undefined) {
|
if (location === undefined) {
|
||||||
|
@ -163,19 +161,15 @@ export default class GeoLocationHandler {
|
||||||
id: "gps-" + i,
|
id: "gps-" + i,
|
||||||
"user:location": "yes",
|
"user:location": "yes",
|
||||||
date: new Date().toISOString(),
|
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++
|
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>{
|
const feature = <Feature>{
|
||||||
type: "Feature",
|
type: "Feature",
|
||||||
properties,
|
properties,
|
||||||
|
@ -184,7 +178,6 @@ export default class GeoLocationHandler {
|
||||||
coordinates: [location.longitude, location.latitude],
|
coordinates: [location.longitude, location.latitude],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
features.setData([feature])
|
features.setData([feature])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
import Lazy from "../Base/Lazy"
|
import Lazy from "../Base/Lazy"
|
||||||
import BaseUIElement from "../BaseUIElement"
|
import BaseUIElement from "../BaseUIElement"
|
||||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
||||||
|
import { VariableUiElement } from "../Base/VariableUIElement";
|
||||||
|
|
||||||
//Svelte props
|
//Svelte props
|
||||||
export let tags: UIEventSource<any>
|
export let tags: UIEventSource<any>
|
||||||
|
@ -54,13 +55,7 @@
|
||||||
return parts
|
return parts
|
||||||
})
|
})
|
||||||
|
|
||||||
let _allTags = []
|
const tagsTable = new VariableUiElement(allTags.mapD(_allTags => new Table(["Key", "Value"], _allTags).SetClass("zebra-table break-all")))
|
||||||
onDestroy(
|
|
||||||
allTags.addCallbackAndRunD((allTags) => {
|
|
||||||
_allTags = allTags
|
|
||||||
})
|
|
||||||
)
|
|
||||||
const tagsTable = new Table(["Key", "Value"], _allTags).SetClass("zebra-table break-all")
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// Testing grounds
|
// 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>
|
</script>
|
||||||
|
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<LanguagePicker preferredLanguages={["nl", "en"]}/>
|
No tests
|
||||||
|
|
||||||
<Tr t={Translations.t.general.download.downloadAsPdf}/>
|
|
||||||
{$language}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue