Only remove the vertex feature if it exists

When deleting a vertex shared by multiple features, we iterate through drag segments and only need to remove the vertex feature once.
This commit is contained in:
Tim Schaub
2015-08-03 22:44:22 -06:00
parent d3c8880b22
commit 85ddded15c

View File

@@ -888,8 +888,10 @@ ol.interaction.Modify.prototype.removeVertex_ = function() {
newSegmentData);
this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);
this.overlay_.getSource().removeFeature(this.vertexFeature_);
this.vertexFeature_ = null;
if (!goog.isNull(this.vertexFeature_)) {
this.overlay_.getSource().removeFeature(this.vertexFeature_);
this.vertexFeature_ = null;
}
}
}
}