modify feature control must use silent:true when removing/destroying vertices, p=me, r=crschmidt (closes #1562)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7614 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-07-30 20:26:13 +00:00
parent eb417ff61c
commit c2c23cb3f3
3 changed files with 32 additions and 24 deletions

View File

@@ -401,6 +401,8 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
}
this.features = OpenLayers.Util.removeItem(this.features, feature);
// feature has no layer at this point
feature.layer = null;
if (feature.geometry) {
this.renderer.eraseGeometry(feature.geometry);
@@ -432,21 +434,17 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
* features - {Array(<OpenLayers.Feature.Vector>)} An optional array of
* features to destroy. If not supplied, all features on the layer
* will be destroyed.
* options - {Object}
*/
destroyFeatures: function(features) {
var all = (features == undefined);
destroyFeatures: function(features, options) {
var all = (features == undefined); // evaluates to true if
// features is null
if(all) {
features = this.features;
this.selectedFeatures = [];
}
this.eraseFeatures(features);
var feature;
for(var i=features.length-1; i>=0; i--) {
feature = features[i];
if(!all) {
OpenLayers.Util.removeItem(this.selectedFeatures, feature);
}
feature.destroy();
this.removeFeatures(features, options);
for (var i = 0; i < features.length; i++) {
features[i].destroy();
}
},