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