I'm trying to add a select interaction on a vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle
does not return the style of the selected feature. Can anyone help, please?
if(this._map){
const selectClick = new Select({
condition: doubleClick,
layers: [this._vectorLayer]
});
this._selectInteraction = selectClick;
this._map.addInteraction(selectClick);
selectClick.on('select', function (e) {
console.log(e.selected[0].getStyle());
});
}
returns
ƒ (feature) {
if (!feature.getGeometry()) {
return null;
}
return styles[feature.getGeometry().getType()];
}