From 6628d38dc59238c1b18eb2518d5858f609c02a1e Mon Sep 17 00:00:00 2001 From: euzuro Date: Wed, 7 Jun 2006 16:12:27 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Layer/Text.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/OpenLayers/Layer/Text.js b/lib/OpenLayers/Layer/Text.js index 2fe8eb05ac..c010648bf0 100644 --- a/lib/OpenLayers/Layer/Text.js +++ b/lib/OpenLayers/Layer/Text.js @@ -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"