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. */