I'm using OpenLayers-3.8.2. I want to select a feature and then delete it. my code is as follow:
deleteFeature = function(event){ var feature = event.selected[0]; myLayer.getSource().removeFeature(feature);}selectInteraction = new ol.interaction.Select({ condition: ol.events.condition.singleClick, toggleCondition: ol.events.condition.shiftKeyOnly, layers: [myLayer]})map.addInteraction(selectInteraction);selectInteraction.on("select", deleteFeature, this);This code delete the feature from source but it still showed in map.
How can I unselect a feature?
أكثر...
deleteFeature = function(event){ var feature = event.selected[0]; myLayer.getSource().removeFeature(feature);}selectInteraction = new ol.interaction.Select({ condition: ol.events.condition.singleClick, toggleCondition: ol.events.condition.shiftKeyOnly, layers: [myLayer]})map.addInteraction(selectInteraction);selectInteraction.on("select", deleteFeature, this);This code delete the feature from source but it still showed in map.
How can I unselect a feature?
أكثر...