Disable feature box if the feature has changed upstream and no longer matches the layer definition

This commit is contained in:
Pieter Vander Vennet 2024-02-20 23:47:49 +01:00
parent ac90379499
commit cae8854dbe
2 changed files with 12 additions and 1 deletions

View file

@ -27,6 +27,7 @@
"selectReason": "Please, select why this feature should be deleted",
"softDelete": "This feature will be updated and hidden from this application. <span class='subtle'>{reason}</span>"
},
"isChanged": "This feature has been changed and no longer matches this layer",
"isDeleted": "This feature is deleted",
"isntAPoint": "Only nodes can be deleted, the selected feature is a way, area or relation.",
"loading": "Inspecting properties to check if this feature can be deleted.",

View file

@ -18,6 +18,12 @@
selectedElement.properties.id
)
let stillMatches = tags.map(tags => {
console.log("Tags are now:",tags, layer.source.osmTags?.matchesProperties(tags))
return !layer.source?.osmTags || layer.source.osmTags?.matchesProperties(tags)
})
let _metatags: Record<string, string>
onDestroy(
state.userRelatedState.preferencesAsTags.addCallbackAndRun((tags) => {
@ -35,7 +41,11 @@
)
</script>
{#if $tags._deleted === "yes"}
{#if !$stillMatches}
<div class="alert" aria-live="assertive">
<Tr t={Translations.t.delete.isChanged}/>
</div>
{:else if $tags._deleted === "yes"}
<div aria-live="assertive">
<Tr t={Translations.t.delete.isDeleted} />
</div>