OpenLayers 3 capturing various click events
ah ok dblclick
is the answer
// set mode to current mode of double clicked feature
map.on('dblclick', function(evt) {
console.log('doubled');
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
// do stuff here
});
});
and evt.originalEvent.altKey
, evt.originalEvent.ctrlKey
, evt.originalEvent.metaKey
, evt.originalEvent.shitKey
are all availabe within the handler!
Get clicked XY coordinates in ol3
map.on('click', function(evt) {
var coordinates = evt.coordinate;
alert(coordinates);
});