[OpenLayers-Commits] r7526 - sandbox/topp/trimet/lib/OpenLayers/Layer
commits at openlayers.org
commits at openlayers.org
Wed Jul 16 12:41:19 EDT 2008
Author: tschaub
Date: 2008-07-16 12:41:19 -0400 (Wed, 16 Jul 2008)
New Revision: 7526
Modified:
sandbox/topp/trimet/lib/OpenLayers/Layer/Vector.js
Log:
Replacing featuresdestroyed with the already available featuresremoved event. Will need to revisit.
Modified: sandbox/topp/trimet/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/topp/trimet/lib/OpenLayers/Layer/Vector.js 2008-07-16 15:35:36 UTC (rev 7525)
+++ sandbox/topp/trimet/lib/OpenLayers/Layer/Vector.js 2008-07-16 16:41:19 UTC (rev 7526)
@@ -511,20 +511,29 @@
/**
* APIMethod: destroyFeatures
- * Erase and destroy features on the layer.
+ * Erase and destroy features on the layer. The featuresremoved event
+ * will be triggered unless the silent option is true.
*
* Parameters:
* 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} Options to control behavior while destroying features.
+ *
+ * Valid options:
+ * silent - {Boolean} Do not trigger any events while destroying. Default
+ * is false.
*/
- destroyFeatures: function(features) {
+ destroyFeatures: function(features, options) {
var all = (features == undefined);
if(all) {
features = this.features;
this.selectedFeatures = [];
}
this.eraseFeatures(features);
+ if(!options || !options.silent) {
+ this.events.triggerEvent("featuresremoved", {features: features});
+ }
var feature;
for(var i=features.length-1; i>=0; i--) {
feature = features[i];
@@ -533,7 +542,6 @@
}
feature.destroy();
}
- this.events.triggerEvent("featuresdestroyed", {features: this.features});
},
/**
More information about the Commits
mailing list