Add insertVertexCondition to ol.interaction.Modify options

This commit is contained in:
Frederic Junod
2017-05-09 13:35:21 +02:00
parent 735ab45480
commit ff91974345
4 changed files with 64 additions and 4 deletions

View File

@@ -222,7 +222,13 @@ var select = new ol.interaction.Select({
var modify = new ol.interaction.Modify({
features: select.getFeatures(),
style: overlayStyle
style: overlayStyle,
insertVertexCondition: function() {
// prevent new vertices to be added to the polygons
return !this.features_.getArray().every(function(feature) {
return feature.getGeometry().getType().match(/Polygon/);
});
}
});
var map = new ol.Map({