UX: do not show nearby features box if there are none

This commit is contained in:
Pieter Vander Vennet 2023-11-30 01:41:41 +01:00
parent e7c2bd54f7
commit 8e73369308

View file

@ -76,7 +76,6 @@
let showCrosshair = state.userRelatedState.showCrosshair
let arrowKeysWereUsed = state.mapProperties.lastKeyNavigation
let centerFeatures = state.closestFeatures.features
$: console.log("Centerfeatures are", $centerFeatures)
const selectedElementView = selectedElement.map(
(selectedElement) => {
// Svelte doesn't properly reload some of the legacy UI-elements
@ -99,7 +98,7 @@
tags,
}).SetClass("h-full w-full")
},
[selectedLayer]
[selectedLayer],
)
const selectedElementTitle = selectedElement.map(
@ -115,7 +114,7 @@
const tags = state.featureProperties.getStore(selectedElement.properties.id)
return new SvelteUIElement(SelectedElementTitle, { state, layer, selectedElement, tags })
},
[selectedLayer]
[selectedLayer],
)
let mapproperties: MapProperties = state.mapProperties
@ -129,7 +128,7 @@
onDestroy(
rasterLayer.addCallbackAndRunD((l) => {
rasterLayerName = l.properties.name
})
}),
)
</script>
@ -231,8 +230,8 @@
</a>
</div>
</div>
{#if $arrowKeysWereUsed !== undefined}
{#if $centerFeatures.length > 0}
<div class="interactive pointer-events-auto p-1">
{#each $centerFeatures as feat, i (feat.properties.id)}
<div class="flex">
@ -242,6 +241,7 @@
{/each}
</div>
{/if}
{/if}
<div class="flex flex-col items-end">
<!-- bottom right elements -->
<If condition={state.floors.map((f) => f.length > 1)}>