Fix: size of new element picker map (#1701), add debug info about GPS

This commit is contained in:
Pieter Vander Vennet 2023-11-12 10:14:51 +01:00
parent cc03c142dc
commit 9407ed35b1
4 changed files with 39 additions and 8 deletions

View file

@ -724,6 +724,11 @@
"id": "debug", "id": "debug",
"condition": "mapcomplete-show_debug=yes", "condition": "mapcomplete-show_debug=yes",
"render": "{all_tags()}" "render": "{all_tags()}"
},
{
"id":"debug-gps",
"condition": "mapcomplete-show_debug=yes",
"render": "{gps_all_tags()}"
} }
] ]
} }

View file

@ -20,6 +20,11 @@
_metatags = tags _metatags = tags
}) })
) )
let knownTagRenderings = layer.tagRenderings
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
&& config.IsKnown($tags)))
</script> </script>
{#if $tags._deleted === "yes"} {#if $tags._deleted === "yes"}
@ -29,9 +34,7 @@
</button> </button>
{:else} {:else}
<div class="flex h-full flex-col gap-y-2 overflow-y-auto p-1 px-2"> <div class="flex h-full flex-col gap-y-2 overflow-y-auto p-1 px-2">
{#each layer.tagRenderings as config (config.id)} {#each knownTagRenderings as config (config.id)}
{#if (config.condition?.matchesProperties($tags) ?? true) && config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)}
{#if config.IsKnown($tags)}
<TagRenderingEditable <TagRenderingEditable
{tags} {tags}
{config} {config}
@ -39,9 +42,8 @@
{selectedElement} {selectedElement}
{layer} {layer}
{highlightedRendering} {highlightedRendering}
clss={knownTagRenderings.length === 1 ? "h-full" : "tr-length-"+knownTagRenderings.length}
/> />
{/if}
{/if}
{/each} {/each}
</div> </div>
{/if} {/if}

View file

@ -21,7 +21,7 @@
export let editingEnabled: Store<boolean> | undefined = state?.featureSwitchUserbadge export let editingEnabled: Store<boolean> | undefined = state?.featureSwitchUserbadge
export let highlightedRendering: UIEventSource<string> = undefined export let highlightedRendering: UIEventSource<string> = 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 * Indicates if this tagRendering currently shows the attribute or asks the question to _change_ the property
*/ */
@ -71,7 +71,7 @@
} }
</script> </script>
<div bind:this={htmlElem}> <div bind:this={htmlElem} class={clss}>
{#if config.question && (!editingEnabled || $editingEnabled)} {#if config.question && (!editingEnabled || $editingEnabled)}
{#if editMode} {#if editMode}
<TagRenderingQuestion {config} {tags} {selectedElement} {state} {layer}> <TagRenderingQuestion {config} {tags} {selectedElement} {state} {layer}>
@ -106,7 +106,7 @@
</div> </div>
{/if} {/if}
{:else} {:else}
<div class="w-full overflow-hidden p-2"> <div class="w-full h-full overflow-hidden p-2">
<TagRenderingAnswer {config} {tags} {selectedElement} {state} {layer} /> <TagRenderingAnswer {config} {tags} {selectedElement} {state} {layer} />
</div> </div>
{/if} {/if}

View file

@ -77,6 +77,7 @@ import ReviewForm from "./Reviews/ReviewForm.svelte"
import Questionbox from "./Popup/TagRendering/Questionbox.svelte" import Questionbox from "./Popup/TagRendering/Questionbox.svelte"
import { TagUtils } from "../Logic/Tags/TagUtils" import { TagUtils } from "../Logic/Tags/TagUtils"
import Giggity from "./BigComponents/Giggity.svelte" import Giggity from "./BigComponents/Giggity.svelte"
import ThemeViewState from "../Models/ThemeViewState"
class NearbyImageVis implements SpecialVisualization { class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests // 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 }) 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<Record<string, string>>,
argument: string[],
feature: Feature,
layer: LayerConfig
): BaseUIElement {
const tags = (<ThemeViewState>(
state
)).geolocation.currentUserLocation.features.map(
(features) => features[0].properties
)
return new SvelteUIElement(AllTagsPanel, {
state,
tags,
})
},
},
] ]
specialVisualizations.push(new AutoApplyButton(specialVisualizations)) specialVisualizations.push(new AutoApplyButton(specialVisualizations))