I cannot create a new Click Event since ol V5 (example to simulate a click on a feature) :
var coordinates = feature.getGeometry().getCoordinates();
var pixel = map.getPixelFromCoordinate(coordinates);
var evt = new ol.MapEvent();
evt.type = ol.MapBrowserEventType.CLICK;
evt.pixel = pixel;
map.dispatchEvent(evt);
Error :
ol.MapEvent is not a constructor
I use the full build ol.js.
It works by using a jQuery event ...
var evt = jQuery.Event( "click", { target: sMap.olMap.getTargetElement(), pixel: pixel, pageX: pixel[0], pageY: pixel[1] } );
Why we cannot instanciate MapEvent or MapBrowserEvent anymore ? Or what is the good way to do that ?
Thx