diff --git a/Logic/FeatureSource/Sources/FeatureSourceMerger.ts b/Logic/FeatureSource/Sources/FeatureSourceMerger.ts index 87b011edd4..8b0292b7dc 100644 --- a/Logic/FeatureSource/Sources/FeatureSourceMerger.ts +++ b/Logic/FeatureSource/Sources/FeatureSourceMerger.ts @@ -30,6 +30,9 @@ export default class FeatureSourceMerger implements IndexedFeatureSource { } public addSource(source: FeatureSource) { + if(!source){ + return + } this._sources.push(source) source.features.addCallbackAndRun(() => { this.addData(this._sources.map((s) => s.features.data)) diff --git a/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts b/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts index c607d0d311..64298f7dee 100644 --- a/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts +++ b/Logic/FeatureSource/TiledFeatureSource/DynamicGeoJsonTileSource.ts @@ -71,7 +71,7 @@ export default class DynamicGeoJsonTileSource extends DynamicTileSource { if (!isWhiteListed) { console.debug( "Not downloading tile", - ...zxy, + zxy, "as it is not on the whitelist" ) return undefined diff --git a/UI/BigComponents/SelectedElementTitle.svelte b/UI/BigComponents/SelectedElementTitle.svelte new file mode 100644 index 0000000000..03fd6c1e56 --- /dev/null +++ b/UI/BigComponents/SelectedElementTitle.svelte @@ -0,0 +1,57 @@ + + + +{#if _tags._deleted === "yes"} + +{:else} +
+
+ + +

+ +

+ +
+ {#each layer.titleIcons as titleIconConfig} + {#if (titleIconConfig.condition?.matchesProperties(_tags) ?? true) && (titleIconConfig.metacondition?.matchesProperties({..._metatags, ..._tags}) ?? true) && titleIconConfig.IsKnown(_tags)} +
+ +
+ {/if} + {/each} +
+ +
+ state.selectedElement.setData(undefined)}/> +
+{/if} diff --git a/UI/BigComponents/SelectedElementView.svelte b/UI/BigComponents/SelectedElementView.svelte index 3632741abc..73c470da7a 100644 --- a/UI/BigComponents/SelectedElementView.svelte +++ b/UI/BigComponents/SelectedElementView.svelte @@ -3,12 +3,10 @@ import {UIEventSource} from "../../Logic/UIEventSource"; import LayerConfig from "../../Models/ThemeConfig/LayerConfig"; import type {SpecialVisualizationState} from "../SpecialVisualization"; - import TagRenderingAnswer from "../Popup/TagRendering/TagRenderingAnswer.svelte"; import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte"; import {onDestroy} from "svelte"; import Translations from "../i18n/Translations"; import Tr from "../Base/Tr.svelte"; - import {XCircleIcon} from "@rgossiaux/svelte-heroicons/solid"; export let state: SpecialVisualizationState; export let layer: LayerConfig; @@ -32,30 +30,6 @@ {#if _tags._deleted === "yes"} {:else} -
-
-
- - -

- -

- -
- {#each layer.titleIcons as titleIconConfig} - {#if (titleIconConfig.condition?.matchesProperties(_tags) ?? true) && (titleIconConfig.metacondition?.matchesProperties(_tags) ?? true) && titleIconConfig.IsKnown(_tags)} -
- -
- {/if} - {/each} -
- -
- state.selectedElement.setData(undefined)}/> -
{#each layer.tagRenderings as config (config.id)} {#if (config.condition === undefined || config.condition.matchesProperties(_tags)) && (config.metacondition === undefined || config.metacondition.matchesProperties({..._tags, ..._metatags}))} @@ -66,6 +40,4 @@ {/if} {/each}
- -
{/if} diff --git a/UI/Popup/TagRendering/TagRenderingMappingInput.svelte b/UI/Popup/TagRendering/TagRenderingMappingInput.svelte index 33182f31b6..76736f569e 100644 --- a/UI/Popup/TagRendering/TagRenderingMappingInput.svelte +++ b/UI/Popup/TagRendering/TagRenderingMappingInput.svelte @@ -30,6 +30,13 @@ export let mappingIsSelected: boolean * This is the searchterm where it might hide */ export let searchTerm: undefined | UIEventSource + +$: { + if(selectedElement !== undefined || mapping !== undefined){ + searchTerm.setData(undefined) + } +} + let matchesTerm: Store | undefined = searchTerm?.map(search => { if (!search) { return true @@ -45,7 +52,7 @@ let matchesTerm: Store | undefined = searchTerm?.map(search => { if (mapping.then.txt.toLowerCase().indexOf(search) >= 0) { return true } - const searchTerms = mapping?.searchTerms[Locale.language.data] + const searchTerms = mapping?.searchTerms?.[Locale.language.data] if (searchTerms?.some(t => t.toLowerCase().indexOf(search) >= 0)) { return true } diff --git a/UI/ThemeViewGUI.svelte b/UI/ThemeViewGUI.svelte index 7c304d1e79..16aaade372 100644 --- a/UI/ThemeViewGUI.svelte +++ b/UI/ThemeViewGUI.svelte @@ -37,6 +37,7 @@ import LevelSelector from "./BigComponents/LevelSelector.svelte"; import Svg from "../Svg"; import ExtraLinkButton from "./BigComponents/ExtraLinkButton"; + import SelectedElementTitle from "./BigComponents/SelectedElementTitle.svelte"; export let state: ThemeViewState; let layout = state.layout; @@ -45,7 +46,7 @@ let selectedElement: UIEventSource = state.selectedElement; let selectedLayer: UIEventSource = state.selectedLayer; - const selectedViewElement = selectedElement.map(selectedElement => { + const selectedElementView = selectedElement.map(selectedElement => { // Svelte doesn't properly reload some of the legacy UI-elements // As such, we _reconstruct_ the selectedElementView every time a new feature is selected // This is a bit wasteful, but until everything is a svelte-component, this should do the trick @@ -55,7 +56,20 @@ } const tags = state.featureProperties.getStore(selectedElement.properties.id); - return new SvelteUIElement(SelectedElementView, {state, layer, selectedElement, tags}); + return new SvelteUIElement(SelectedElementView, {state, layer, selectedElement, tags}) + }, [selectedLayer]); + + const selectedElementTitle = selectedElement.map(selectedElement => { + // Svelte doesn't properly reload some of the legacy UI-elements + // As such, we _reconstruct_ the selectedElementView every time a new feature is selected + // This is a bit wasteful, but until everything is a svelte-component, this should do the trick + const layer = selectedLayer.data; + if (selectedElement === undefined || layer === undefined) { + return undefined; + } + + const tags = state.featureProperties.getStore(selectedElement.properties.id); + return new SvelteUIElement(SelectedElementTitle, {state, layer, selectedElement, tags}) }, [selectedLayer]); @@ -132,15 +146,19 @@ - v !== undefined && selectedLayer.data !== undefined && !selectedLayer.data.popupInFloatover,[ selectedLayer] )}> + v !== undefined && selectedLayer.data !== undefined && !selectedLayer.data.popupInFloatover,[ selectedLayer] )}> {selectedElement.setData(undefined)}}> - +
+ + + +
- v !== undefined && selectedLayer.data !== undefined && selectedLayer.data.popupInFloatover,[ selectedLayer] )}> + v !== undefined && selectedLayer.data !== undefined && selectedLayer.data.popupInFloatover,[ selectedLayer] )}> {selectedElement.setData(undefined)}}> - + diff --git a/package.json b/package.json index 564140159d..e4712581a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mapcomplete", - "version": "0.30.3", + "version": "0.30.4", "repository": "https://github.com/pietervdvn/MapComplete", "description": "A small website to edit OSM easily", "bugs": "https://github.com/pietervdvn/MapComplete/issues",