ol-contextmenu
ol-contextmenu copied to clipboard
Accessing selected Items
Hi, I am in in an Angular environment and using the ol-ext editBar extension to be able to select features.
What I was wanting to do is to use ol-contextmenu to provide a showInfo functionality to display the attributes of the selected features. I have defined the callback as shown below which has access to the event object. Unfortunately the event object does not seem to give access to the map object (or the already selected features). Is it possible to access these selected features by some technique?
Many thanks for any thoghts.
{ text: 'Show info', classname: 'bold', icon: infoIcon, callback: (event: any) => { console.log('[CONTEXTMENU] Show Info',event); showInfoAtPoint(event); } },
Thanks
To help others I managed to access this.map in the callback defintion and then pass it to the callback procedure with the callBack defined within the Angular class. My callBack procedure is currently outside the Angular class (which feels wrong and cannot access this.map unless its passed through to it). This feels like the wrong way to do this but has got it working for me.
Thanks
showInfoAtPoint(event, this.map);