Is there a way to implement a right-click context menu that displays information about the clicked point?
For example, when I right-click on a map, a dropdown menu should appear with options like 'add marker', and it should also show the coordinates of the clicked position.
To simplify this process, could someone please add a basic dropdown menu for right-click events to this Test Fiddle?
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: false
})
}),
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
I came across a similar solution, but unfortunately, it didn't work as expected: