Fix: linking images is not possible for notes or non-openstreetmap elements

This commit is contained in:
Pieter Vander Vennet 2024-12-06 01:07:30 +01:00
parent 378f55b544
commit 7f9f7e7534
3 changed files with 20 additions and 13 deletions

View file

@ -132,7 +132,8 @@
},
"special": {
"type": "nearby_images",
"mode": "open"
"mode": "open",
"readonly": "yes"
}
}
},

View file

@ -59,12 +59,12 @@
type: "Feature",
geometry: {
type: "Point",
coordinates: [p4c.coordinates.lng, p4c.coordinates.lat],
coordinates: [p4c.coordinates.lng, p4c.coordinates.lat]
},
properties: {
id: p4c.pictureUrl,
rotation: p4c.direction,
},
rotation: p4c.direction
}
}
)
)
@ -76,14 +76,14 @@
type: "Feature",
geometry: {
type: "Point",
coordinates: [s.coordinates.lng, s.coordinates.lat],
coordinates: [s.coordinates.lng, s.coordinates.lat]
},
properties: {
id: s.pictureUrl,
selected: "yes",
rotation: s.direction,
},
},
rotation: s.direction
}
}
]
})
@ -108,7 +108,7 @@
rotation: state.mapProperties.rotation,
pitch: state.mapProperties.pitch,
zoom: new UIEventSource<number>(16),
location: new UIEventSource({ lon, lat }),
location: new UIEventSource({ lon, lat })
})
const geocodedImageLayer = new LayerConfig(<LayerConfigJson>geocoded_image)
@ -118,7 +118,7 @@
zoomToFeatures: true,
onClick: (feature) => {
highlighted.set(feature.properties.id)
},
}
})
ShowDataLayer.showMultipleLayers(map, new StaticFeatureSource([feature]), state.theme.layers)
@ -141,8 +141,14 @@
layer: geocodedImageLayer,
onClick: (feature) => {
highlighted.set(feature.properties.id)
},
}
})
onDestroy(tags.addCallbackAndRunD(tags => {
if (tags.id.startsWith("node/") || tags.id.startsWith("way/") || tags.id.startsWith("relation/")) {
return
}
linkable = false
}))
</script>
<div class="flex flex-col">

View file

@ -112,7 +112,7 @@ class NearbyImageVis implements SpecialVisualization {
{
name: "readonly",
required: false,
doc: "If 'readonly', will not show the 'link'-button",
doc: "If 'readonly' or 'yes', will not show the 'link'-button",
},
]
docs =
@ -128,7 +128,7 @@ class NearbyImageVis implements SpecialVisualization {
layer: LayerConfig
): SvelteUIElement {
const isOpen = args[0] === "open"
const readonly = args[1] === "readonly"
const readonly = args[1] === "readonly" || args[1] === "yes"
const [lon, lat] = GeoOperations.centerpointCoordinates(feature)
return new SvelteUIElement(isOpen ? NearbyImages : NearbyImagesCollapsed, {
tags,