Geographic Information Systems Asked on January 21, 2021
Is there a way to trigger openlayers event from console. In this case:
ol.interaction.Select event which listens ‘select’ (ol.SelectEvent.select). It triggers when feature is selected or deselected by mouse click.
In the mean time I have found the answer. There is OpenLayers built in function for dispatchingEvents :
ol.events.EventTarget.prototype.dispatchEvent.call(this,event);
this references the object on which we add event listener
In my case:
var fakeOnSelectEvent = new ol.interaction.Select.Event(ol.interaction.Select.EventType.SELECT, [], [], false);
var selectInteraction = new ol.interaction.Select({...});
ol.events.EventTarget.prototype.dispatchEvent.call(selectInteraction,fakeOnSelectEvent);
Answered by Goran on January 21, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP