on destroy(), go through and destroy() all of the features we have created.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@544 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -31,6 +31,14 @@ OpenLayers.Layer.Text.prototype =
|
||||
{ method: 'get', onComplete:this.parseData.bind(this) } );
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
destroy: function() {
|
||||
this.clearFeatures();
|
||||
this.features = null;
|
||||
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {?} ajaxRequest
|
||||
@@ -133,6 +141,18 @@ OpenLayers.Layer.Text.prototype =
|
||||
Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
clearFeatures: function() {
|
||||
if (this.features != null) {
|
||||
while(this.features.length > 0) {
|
||||
var feature = this.features[0];
|
||||
this.features.remove(feature);
|
||||
feature.destroy();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Text"
|
||||
|
||||
Reference in New Issue
Block a user