I could able to remove the recent modified vertex of a feature using removePoint
method of modify interaction, as well as using deleteCondition
event of modify interaction. However, that is not what I am trying to achieve. The usecaseuse case for this this problem is as below.
I have modify interaction added on map. Now when user tries to modify a feature over map, I am highlighting the vertices, like this
if(this.modifyInteraction.features_.getLength() && this.modifyInteraction.features_.getArray()[0]){
//Feature being modified
let modifyft = this.modifyInteraction.features_.getArray()[0];
let coord = modifyft.getGeometry().getCoordinates()[0];
let foundIndex;
for(var k = 0; k < coord.length; k++){
if(coord[k][0] == rightClickedVertex.getGeometry().getCoordinates()[0] &&
coord[k][1] == rightClickedVertex.getGeometry().getCoordinates()[1]){
foundIndex = k;
break;
}
}
if(foundIndex && foundIndex > -1){
modifyft.getGeometry().getCoordinates()[0].splice(foundIndex, 1);
//nothing changes
}
}
if(this.modifyInteraction.features_.getLength() && this.modifyInteraction.features_.getArray()[0]){
//Feature being modified
let modifyft = this.modifyInteraction.features_.getArray()[0];
let coord = modifyft.getGeometry().getCoordinates()[0];
let foundIndex;
for(var k = 0; k < coord.length; k++){
if(coord[k][0] == rightClickedVertex.getGeometry().getCoordinates()[0] &&
coord[k][1] == rightClickedVertex.getGeometry().getCoordinates()[1]){
foundIndex = k;
break;
}
}
if(foundIndex && foundIndex > -1){
modifyft.getGeometry().getCoordinates()[0].splice(foundIndex, 1);
//nothing changes
}
}