Merge develop

This commit is contained in:
Pieter Vander Vennet 2024-01-16 04:27:59 +01:00
commit c672fe7668
138 changed files with 14304 additions and 1299 deletions

View file

@ -153,11 +153,7 @@ export default class GeoLocationHandler {
const features: UIEventSource<Feature[]> = new UIEventSource<Feature[]>([])
this.currentUserLocation = new StaticFeatureSource(features)
let i = 0
this.geolocationState.currentGPSLocation.addCallbackAndRun((location) => {
if (location === undefined) {
return
}
this.geolocationState.currentGPSLocation.addCallbackAndRunD((location) => {
const properties = {
id: "gps-" + i,
"user:location": "yes",
@ -200,7 +196,6 @@ export default class GeoLocationHandler {
)
})
features.ping()
let i = 0
this.currentUserLocation?.features?.addCallbackAndRunD(([location]: [Feature<Point>]) => {
if (location === undefined) {
return
@ -231,7 +226,6 @@ export default class GeoLocationHandler {
const feature = JSON.parse(JSON.stringify(location))
feature.properties.id = "gps/" + features.data.length
i++
features.data.push(feature)
features.ping()
})

View file

@ -1,13 +1,11 @@
import ImageProvider, { ProvidedImage } from "./ImageProvider"
import BaseUIElement from "../../UI/BaseUIElement"
import Svg from "../../Svg"
import { WikimediaImageProvider } from "./WikimediaImageProvider"
import Wikidata from "../Web/Wikidata"
import SvelteUIElement from "../../UI/Base/SvelteUIElement"
import * as Wikidata_icon from "../../assets/svg/Wikidata.svelte"
export class WikidataImageProvider extends ImageProvider {
public apiUrls(): string[] {
return Wikidata.neededUrls
}
public static readonly singleton = new WikidataImageProvider()
public readonly defaultKeyPrefixes = ["wikidata"]
@ -15,8 +13,12 @@ export class WikidataImageProvider extends ImageProvider {
super()
}
public apiUrls(): string[] {
return Wikidata.neededUrls
}
public SourceIcon(): BaseUIElement {
return Svg.wikidata_svg()
return new SvelteUIElement(Wikidata_icon)
}
public async ExtractUrls(key: string, value: string): Promise<Promise<ProvidedImage>[]> {

View file

@ -4,6 +4,8 @@ import Svg from "../../Svg"
import { Utils } from "../../Utils"
import { LicenseInfo } from "./LicenseInfo"
import Wikimedia from "../Web/Wikimedia"
import SvelteUIElement from "../../UI/Base/SvelteUIElement"
import Wikimedia_commons_white from "../../assets/svg/Wikimedia_commons_white.svelte"
/**
* This module provides endpoints for wikimedia and others
@ -70,7 +72,7 @@ export class WikimediaImageProvider extends ImageProvider {
}
SourceIcon(): BaseUIElement {
return Svg.wikimedia_commons_white_svg().SetStyle("width:2em;height: 2em")
return new SvelteUIElement(Wikimedia_commons_white).SetStyle("width:2em;height: 2em")
}
public PrepUrl(value: string): ProvidedImage {

View file

@ -399,11 +399,12 @@ export class OsmConnection {
return id
}
public static GpxTrackVisibility = ["private", "public", "trackable", "identifiable"] as const
public async uploadGpxTrack(
gpx: string,
options: {
description: string
visibility: "private" | "public" | "trackable" | "identifiable"
visibility: (typeof OsmConnection.GpxTrackVisibility)[number]
filename?: string
/**
* Some words to give some properties;
@ -425,11 +426,14 @@ export class OsmConnection {
const contents = {
file: gpx,
description: options.description ?? "",
description: options.description,
tags: options.labels?.join(",") ?? "",
visibility: options.visibility,
}
if (!contents.description) {
throw "The description of a GPS-trace cannot be the empty string, undefined or null"
}
const extras = {
file:
'; filename="' +

View file

@ -487,12 +487,6 @@ export default class SimpleMetaTaggers {
feature.properties._isOpen = "yes"
return true
}
console.log(
"Calculating opening hours for",
feature.properties.name,
":",
feature.properties.opening_hours
)
// _isOpen is calculated dynamically on every call
Object.defineProperty(feature.properties, "_isOpen", {

View file

@ -50,6 +50,11 @@ export default class ThemeViewStateHashActor {
if (!!hash) {
// There is still a hash
// We _only_ have to (at most) close the overlays in this case
if (state.previewedImage.data) {
state.previewedImage.setData(undefined)
return
}
const parts = hash.split(";")
if (parts.indexOf("background") < 0) {
state.guistate.backgroundLayerSelectionIsOpened.setData(false)
@ -176,6 +181,10 @@ export default class ThemeViewStateHashActor {
private back() {
const state = this._state
if (state.previewedImage.data) {
state.previewedImage.setData(undefined)
return
}
// history.pushState(null, null, window.location.pathname);
if (state.selectedElement.data) {
state.selectedElement.setData(undefined)