From 9407ed35b109660a9b23c2b71fd15f3ecf1dc0d0 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 12 Nov 2023 10:14:51 +0100 Subject: [PATCH] Fix: size of new element picker map (#1701), add debug info about GPS --- assets/layers/usersettings/usersettings.json | 5 ++++ .../BigComponents/SelectedElementView.svelte | 12 ++++++---- .../TagRendering/TagRenderingEditable.svelte | 6 ++--- src/UI/SpecialVisualizations.ts | 24 +++++++++++++++++++ 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/assets/layers/usersettings/usersettings.json b/assets/layers/usersettings/usersettings.json index 082cc5ab01..9e6304e4f5 100644 --- a/assets/layers/usersettings/usersettings.json +++ b/assets/layers/usersettings/usersettings.json @@ -724,6 +724,11 @@ "id": "debug", "condition": "mapcomplete-show_debug=yes", "render": "{all_tags()}" + }, + { + "id":"debug-gps", + "condition": "mapcomplete-show_debug=yes", + "render": "{gps_all_tags()}" } ] } diff --git a/src/UI/BigComponents/SelectedElementView.svelte b/src/UI/BigComponents/SelectedElementView.svelte index c780ea931f..afa7b7d871 100644 --- a/src/UI/BigComponents/SelectedElementView.svelte +++ b/src/UI/BigComponents/SelectedElementView.svelte @@ -20,6 +20,11 @@ _metatags = tags }) ) + + + let knownTagRenderings = layer.tagRenderings + .filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true) + && config.IsKnown($tags))) {#if $tags._deleted === "yes"} @@ -29,9 +34,7 @@ {:else}
- {#each layer.tagRenderings as config (config.id)} - {#if (config.condition?.matchesProperties($tags) ?? true) && config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)} - {#if config.IsKnown($tags)} + {#each knownTagRenderings as config (config.id)} - {/if} - {/if} {/each}
{/if} diff --git a/src/UI/Popup/TagRendering/TagRenderingEditable.svelte b/src/UI/Popup/TagRendering/TagRenderingEditable.svelte index 050295e9e4..27d6f09c45 100644 --- a/src/UI/Popup/TagRendering/TagRenderingEditable.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingEditable.svelte @@ -21,7 +21,7 @@ export let editingEnabled: Store | undefined = state?.featureSwitchUserbadge export let highlightedRendering: UIEventSource = undefined - export let showQuestionIfUnknown: boolean = false + export let clss /** * Indicates if this tagRendering currently shows the attribute or asks the question to _change_ the property */ @@ -71,7 +71,7 @@ } -
+
{#if config.question && (!editingEnabled || $editingEnabled)} {#if editMode} @@ -106,7 +106,7 @@
{/if} {:else} -
+
{/if} diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index feb14fc796..967448318e 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -77,6 +77,7 @@ import ReviewForm from "./Reviews/ReviewForm.svelte" import Questionbox from "./Popup/TagRendering/Questionbox.svelte" import { TagUtils } from "../Logic/Tags/TagUtils" import Giggity from "./BigComponents/Giggity.svelte" +import ThemeViewState from "../Models/ThemeViewState" class NearbyImageVis implements SpecialVisualization { // Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests @@ -1471,6 +1472,29 @@ export default class SpecialVisualizations { return new SvelteUIElement(Giggity, { tags: tagSource, state, giggityUrl }) }, }, + { + funcName: "gps_all_tags", + needsUrls: [], + docs: "Shows the current tags of the GPS-representing object, used for debugging", + args: [], + constr( + state: SpecialVisualizationState, + _: UIEventSource>, + argument: string[], + feature: Feature, + layer: LayerConfig + ): BaseUIElement { + const tags = (( + state + )).geolocation.currentUserLocation.features.map( + (features) => features[0].properties + ) + return new SvelteUIElement(AllTagsPanel, { + state, + tags, + }) + }, + }, ] specialVisualizations.push(new AutoApplyButton(specialVisualizations))