Update geometry index inside Snap interaction

This commit is contained in:
Alexandre Dubé
2015-03-26 12:24:54 -04:00
parent d1c3dc51ad
commit 49a3f0a0b7
2 changed files with 88 additions and 15 deletions

View File

@@ -67,18 +67,6 @@ var Modify = {
this.select.on('change:active', function() {
selectedFeatures.forEach(selectedFeatures.remove, selectedFeatures);
});
// since snap control duplicates the geometry of features
// when creating the index and it doesn't rebuild the index
// on 'change:geometry', modified geometries should be handled manualy
selectedFeatures.on('add', function(evt) {
// removes the feature geometry from the snap index
featureOverlay.getFeatures().remove(evt.element);
});
selectedFeatures.on('remove', function(evt) {
// adds the feature geometry to the snap index
featureOverlay.getFeatures().push(evt.element);
});
},
setActive: function(active) {
this.select.setActive(active);