I used rightclick handler with openlayers2 and now I am upgrading my website to openlayers3 and I cannot find this handler in ol3
1 Answer
Just repeating/summarizing some other answers. You can add your own listener on viewport
:
map.getViewport().addEventListener('contextmenu', function (evt) {
evt.preventDefault();
console.info('contextmenu');
});
Or use an extension I've written to address this feature - https://github.com/jonataswalker/ol3-contextmenu - jsFiddle demo.