From e06b15709024c644faccb650872113e47f757d73 Mon Sep 17 00:00:00 2001 From: euzuro Date: Wed, 7 Jun 2006 16:08:15 +0000 Subject: [PATCH] when we destroy a markers layer, remove all of its tiles. do not, however, destroy them... because they were not created here. git-svn-id: http://svn.openlayers.org/trunk/openlayers@541 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Markers.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/OpenLayers/Layer/Markers.js b/lib/OpenLayers/Layer/Markers.js index eb08ffca07..6c45bbf4f9 100644 --- a/lib/OpenLayers/Layer/Markers.js +++ b/lib/OpenLayers/Layer/Markers.js @@ -20,6 +20,16 @@ OpenLayers.Layer.Markers.prototype = this.markers = new Array(); }, + /** + * + */ + destroy: function() { + this.clearMarkers(); + markers = null; + OpenLayers.Layer.prototype.destroy.apply(this, arguments); + }, + + /** * @param {OpenLayers.Bounds} bounds * @param {Boolean} zoomChanged @@ -52,6 +62,17 @@ OpenLayers.Layer.Markers.prototype = } }, + /** + * + */ + clearMarkers: function() { + if (this.markers != null) { + while(this.markers.length > 0) { + this.removeMarker(this.markers[0]); + } + } + }, + /** clear all the marker div's from the layer and then redraw all of them. * Use the map to recalculate new placement of markers. */