diff --git a/Logic/MetaTagging.ts b/Logic/MetaTagging.ts index 5aa42c4ec1..99d7068d5d 100644 --- a/Logic/MetaTagging.ts +++ b/Logic/MetaTagging.ts @@ -164,7 +164,11 @@ export default class MetaTagging { } if (somethingChanged) { - featurePropertiesStores?.getStore(feature.properties.id)?.ping() + try { + featurePropertiesStores?.getStore(feature.properties.id)?.ping() + } catch (e) { + console.error("Could not ping a store for a changed property due to", e) + } atLeastOneFeatureChanged = true } } diff --git a/UI/BigComponents/PdfExportGui.ts b/UI/BigComponents/PdfExportGui.ts index 979de96589..dd280e692c 100644 --- a/UI/BigComponents/PdfExportGui.ts +++ b/UI/BigComponents/PdfExportGui.ts @@ -15,7 +15,6 @@ import BaseUIElement from "../BaseUIElement" import Img from "../Base/Img" import Title from "../Base/Title" import { CheckBox } from "../Input/Checkboxes" -import Minimap from "../Base/Minimap" import SearchAndGo from "./SearchAndGo" import Toggle from "../Input/Toggle" import List from "../Base/List" diff --git a/UI/InputElement/Helpers/FloorSelector.svelte b/UI/InputElement/Helpers/FloorSelector.svelte index faa65eee25..465ced6f9f 100644 --- a/UI/InputElement/Helpers/FloorSelector.svelte +++ b/UI/InputElement/Helpers/FloorSelector.svelte @@ -72,6 +72,9 @@ } Stores.Chronic(50).addCallback(_ => stabilize()); + floors.addCallback(floors => { + forceIndex = floors.findIndex(s => s === value.data) + }) let image: HTMLImageElement; $:{ diff --git a/UI/Popup/AddNewPoint/AddNewPoint.svelte b/UI/Popup/AddNewPoint/AddNewPoint.svelte index 7904e6196c..50028d4985 100644 --- a/UI/Popup/AddNewPoint/AddNewPoint.svelte +++ b/UI/Popup/AddNewPoint/AddNewPoint.svelte @@ -50,7 +50,7 @@ let layerIsDisplayed: UIEventSource | undefined = undefined; let layerHasFilters: Store | undefined = undefined; let globalFilter: UIEventSource = state.layerState.globalFilters; - let _globalFilter: GlobalFilter[]; + let _globalFilter: GlobalFilter[] = []; onDestroy(globalFilter.addCallbackAndRun(globalFilter => { console.log("Global filters are", globalFilter); _globalFilter = globalFilter ?? []; @@ -85,7 +85,7 @@ creating = true; const location: { lon: number; lat: number } = preciseCoordinate.data; const snapTo: WayId | undefined = snappedToObject.data; - const tags: Tag[] = selectedPreset.preset.tags.concat(..._globalFilter.map(f => f.onNewPoint.tags)); + const tags: Tag[] = selectedPreset.preset.tags.concat(..._globalFilter.map(f => f?.onNewPoint?.tags ?? [])); console.log("Creating new point at", location, "snapped to", snapTo, "with tags", tags); let snapToWay: undefined | OsmWay = undefined; @@ -249,7 +249,7 @@ - {:else if _globalFilter.length > checkedOfGlobalFilters} + {:else if _globalFilter?.length > 0 && _globalFilter?.length > checkedOfGlobalFilters} {checkedOfGlobalFilters = checkedOfGlobalFilters + 1}}> diff --git a/UI/Popup/TagApplyButton.ts b/UI/Popup/TagApplyButton.ts index 1027b224d1..dfe16d1b30 100644 --- a/UI/Popup/TagApplyButton.ts +++ b/UI/Popup/TagApplyButton.ts @@ -61,6 +61,7 @@ export default class TagApplyButton implements AutoAction, SpecialVisualization if (kv.length == 2) { tgsSpec.push(<[string, string]>kv) } else if (kv.length < 2) { + console.error("Invalid key spec: no '=' found in " + spec) throw "Invalid key spec: no '=' found in " + spec } else { throw "Invalid key spec: multiple '=' found in " + spec diff --git a/UI/Popup/TagRendering/SpecialTranslation.svelte b/UI/Popup/TagRendering/SpecialTranslation.svelte index 3cea541166..377626e124 100644 --- a/UI/Popup/TagRendering/SpecialTranslation.svelte +++ b/UI/Popup/TagRendering/SpecialTranslation.svelte @@ -11,6 +11,7 @@ import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"; import WeblateLink from "../../Base/WeblateLink.svelte"; import FromHtml from "../../Base/FromHtml.svelte"; + import BaseUIElement from "../../BaseUIElement"; /** * The 'specialTranslation' renders a `Translation`-object, but interprets the special values as well @@ -27,10 +28,26 @@ })); let specs: RenderingSpecification[] = []; $: { - if (txt !== undefined) { - specs = SpecialVisualizations.constructSpecification(txt); + try { + + if (txt !== undefined) { + specs = SpecialVisualizations.constructSpecification(txt); + } + } catch (e) { + console.error("Could not construct a specification and with arguments", txt); } } + + function createVisualisation(specpart: Exclude): BaseUIElement { + { + try { + return specpart.func.constr(state, tags, specpart.args, feature, layer); + } catch (e) { + console.error("Could not construct a special visualisation with specification", specpart, "and tags", tags); + } + } + } + {#each specs as specpart} @@ -40,6 +57,6 @@ {:else if $tags !== undefined } - + {/if} {/each} diff --git a/UI/Popup/TagRendering/TagRenderingAnswer.svelte b/UI/Popup/TagRendering/TagRenderingAnswer.svelte index 431814777a..e977dce32e 100644 --- a/UI/Popup/TagRendering/TagRenderingAnswer.svelte +++ b/UI/Popup/TagRendering/TagRenderingAnswer.svelte @@ -22,7 +22,9 @@ } export let layer: LayerConfig; let trs: { then: Translation; icon?: string; iconClass?: string }[]; - $: trs = Utils.NoNull(config?.GetRenderValues(_tags)); + $:{ + trs = Utils.NoNull(config?.GetRenderValues(_tags)); + } let classes = "" $:classes = config?.classes?.join(" ") ?? ""; diff --git a/UI/ThemeViewGUI.svelte b/UI/ThemeViewGUI.svelte index 5c6b33e133..77c72ddab1 100644 --- a/UI/ThemeViewGUI.svelte +++ b/UI/ThemeViewGUI.svelte @@ -121,7 +121,7 @@ - v !== undefined)}> + v !== undefined && selectedLayer.data !== undefined,[ selectedLayer] )}> {selectedElement.setData(undefined)}}>