From 8b6ee7075cfa3db3da6a40a1cdf3c6be414a18d9 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 22 Jul 2024 17:24:30 +0200 Subject: [PATCH] Fix #1956 with workaround --- src/Logic/MetaTagging.ts | 3 + src/UI/Base/SelectedElementPanel.svelte | 62 +++++++++++++++++ src/UI/Base/TitledPanel.svelte | 5 -- .../BigComponents/SelectedElementTitle.svelte | 6 +- .../BigComponents/SelectedElementView.svelte | 28 +------- src/UI/ThemeViewGUI.svelte | 68 ++++++++++--------- 6 files changed, 106 insertions(+), 66 deletions(-) create mode 100644 src/UI/Base/SelectedElementPanel.svelte diff --git a/src/Logic/MetaTagging.ts b/src/Logic/MetaTagging.ts index 634d18759..c8516d8ea 100644 --- a/src/Logic/MetaTagging.ts +++ b/src/Logic/MetaTagging.ts @@ -198,6 +198,9 @@ export default class MetaTagging { for (let i = 0; i < features.length; i++) { const feature = features[i] const tags = featurePropertiesStores?.getStore(feature.properties.id) + if(!tags){ + continue + } let somethingChanged = false const definedTags = new Set(Object.getOwnPropertyNames(feature.properties)) diff --git a/src/UI/Base/SelectedElementPanel.svelte b/src/UI/Base/SelectedElementPanel.svelte new file mode 100644 index 000000000..cb71bce63 --- /dev/null +++ b/src/UI/Base/SelectedElementPanel.svelte @@ -0,0 +1,62 @@ + + + +{#if !$stillMatches} + +{:else} +
+ + +
+{/if} diff --git a/src/UI/Base/TitledPanel.svelte b/src/UI/Base/TitledPanel.svelte index 859529e32..b7ddbcb11 100644 --- a/src/UI/Base/TitledPanel.svelte +++ b/src/UI/Base/TitledPanel.svelte @@ -1,8 +1,3 @@ - -

diff --git a/src/UI/BigComponents/SelectedElementTitle.svelte b/src/UI/BigComponents/SelectedElementTitle.svelte index 559a9fab8..9aa299c2f 100644 --- a/src/UI/BigComponents/SelectedElementTitle.svelte +++ b/src/UI/BigComponents/SelectedElementTitle.svelte @@ -72,14 +72,14 @@ {/if}

-
state.selectedElement.setData(undefined)} style="border: 0 !important; padding: 0 !important;" use:ariaLabel={Translations.t.general.backToMap} > -
+
diff --git a/src/UI/BigComponents/SelectedElementView.svelte b/src/UI/BigComponents/SelectedElementView.svelte index f3842b778..79d02d5c4 100644 --- a/src/UI/BigComponents/SelectedElementView.svelte +++ b/src/UI/BigComponents/SelectedElementView.svelte @@ -3,12 +3,10 @@ import { Store, UIEventSource } from "../../Logic/UIEventSource" import LayerConfig from "../../Models/ThemeConfig/LayerConfig" import type { SpecialVisualizationState } from "../SpecialVisualization" - import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte" import { onDestroy } from "svelte" import Translations from "../i18n/Translations" import Tr from "../Base/Tr.svelte" import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" - import UserRelatedState from "../../Logic/State/UserRelatedState" import Delete_icon from "../../assets/svg/Delete_icon.svelte" import BackButton from "../Base/BackButton.svelte" import TagRenderingEditableDynamic from "../Popup/TagRendering/TagRenderingEditableDynamic.svelte" @@ -24,24 +22,8 @@ let isAddNew = tags.mapD(t => t?.id?.startsWith(LastClickFeatureSource.newPointElementId) ?? false) - function getLayer(properties: Record) { - if (properties.id === "settings") { - return UserRelatedState.usersettingsConfig - } - if (properties.id.startsWith(LastClickFeatureSource.newPointElementId)) { - return state.layout.layers.find((l) => l.id === "last_click") - } - if (properties.id === "location_track") { - return state.layout.layers.find((l) => l.id === "gps_track") - } - return state.layout.getMatchingLayer(properties) - } - let layer: LayerConfig = getLayer(selectedElement.properties) - - let stillMatches = tags.map( - (tags) => !layer?.source?.osmTags || layer.source.osmTags?.matchesProperties(tags) - ) + export let layer: LayerConfig let _metatags: Record if (state?.userRelatedState?.preferencesAsTags) { @@ -53,7 +35,7 @@ } let knownTagRenderings: Store = tags.mapD((tgs) => - layer.tagRenderings.filter( + layer?.tagRenderings?.filter( (config) => (config.condition?.matchesProperties(tgs) ?? true) && (config.metacondition?.matchesProperties({ ...tgs, ..._metatags }) ?? true) && @@ -62,11 +44,7 @@ ) -{#if !$stillMatches} -
- -
-{:else if $tags._deleted === "yes"} +{#if $tags._deleted === "yes"}
diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte index feefe1ab6..26a24bb77 100644 --- a/src/UI/ThemeViewGUI.svelte +++ b/src/UI/ThemeViewGUI.svelte @@ -18,7 +18,7 @@ EyeIcon, HeartIcon, MenuIcon, - XCircleIcon, + XCircleIcon } from "@rgossiaux/svelte-heroicons/solid" import Tr from "./Base/Tr.svelte" import CommunityIndexView from "./BigComponents/CommunityIndexView.svelte" @@ -72,9 +72,8 @@ import DocumentChartBar from "@babeard/svelte-heroicons/outline/DocumentChartBar" import Marker from "./Map/Marker.svelte" import AboutMapComplete from "./BigComponents/AboutMapComplete.svelte" - import IfNot from "./Base/IfNot.svelte" - import Hotkeys from "./Base/Hotkeys" import HotkeyTable from "./BigComponents/HotkeyTable.svelte" + import SelectedElementPanel from "./Base/SelectedElementPanel.svelte" export let state: ThemeViewState let layout = state.layout @@ -146,7 +145,7 @@ const bottomRight = mlmap.unproject([rect.right, rect.bottom]) const bbox = new BBox([ [topLeft.lng, topLeft.lat], - [bottomRight.lng, bottomRight.lat], + [bottomRight.lng, bottomRight.lat] ]) state.visualFeedbackViewportBounds.setData(bbox) } @@ -213,7 +212,7 @@
- +
{#if $visualFeedback} @@ -287,9 +286,9 @@ htmlElem={openCurrentViewLayerButton} >
- currentViewLayer.defaultIcon()} - /> + currentViewLayer.defaultIcon()} + />
{/if} @@ -303,7 +302,7 @@
Testserver
- {/if} + {/if}
Faking a user (Testmode)
@@ -453,29 +452,32 @@ }} >
-
- - -
+ {/if} {#if $selectedElement !== undefined && $selectedLayer !== undefined && $selectedLayer.popupInFloatover} - { + + {#if $selectedLayer.popupInFloatover === "title"} + { state.selectedElement.setData(undefined) }} - > -
- {#if $selectedLayer.popupInFloatover === "title"} - - - - {/if} - -
-
+ > + + +
+ {:else} + { + state.selectedElement.setData(undefined) + }} + > + + + {/if} + {/if} i !== undefined)}> @@ -551,13 +553,13 @@ state.guistate.backgroundLayerSelectionIsOpened.setData(false) }} > - + @@ -583,7 +585,7 @@
- +