Destroy fix for Control.LayerSwitcher. Fixes #593.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2934 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-03-30 21:57:07 +00:00
parent 6c166a40e6
commit e1590b2a20

View File

@@ -54,6 +54,28 @@ OpenLayers.Control.LayerSwitcher.prototype =
OpenLayers.Control.prototype.initialize.apply(this, arguments);
},
/**
*
*/
destroy: function() {
OpenLayers.Event.stopObservingElement(this.div);
OpenLayers.Event.stopObservingElement(this.minimizeDiv);
OpenLayers.Event.stopObservingElement(this.maximizeDiv);
//clear out layers info and unregister their events
this.clearLayersArray("base");
this.clearLayersArray("data");
this.map.events.unregister("addlayer", this, this.redraw);
this.map.events.unregister("changelayer", this, this.redraw);
this.map.events.unregister("removelayer", this, this.redraw);
this.map.events.unregister("changebaselayer", this, this.redraw);
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},
/**
* @param {OpenLayers.Map} map
*/