fix for #500 - destroying a layer now has an option to not set a new baselayer. we use this in map.destroy()

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2233 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-02-16 20:59:18 +00:00
parent 1d06490b2c
commit 795d6b4d20
2 changed files with 19 additions and 5 deletions
+9 -2
View File
@@ -137,10 +137,17 @@ OpenLayers.Layer.prototype = {
/**
* Destroy is a destructor: this is to alleviate cyclic references which
* the Javascript garbage cleaner can not take care of on its own.
*
* @param {Boolean} setNewBaseLayer Should a new baselayer be selected when
* this has been removed?
* Default is true
*/
destroy: function() {
destroy: function(setNewBaseLayer) {
if (setNewBaseLayer == null) {
setNewBaseLayer = true;
}
if (this.map != null) {
this.map.removeLayer(this);
this.map.removeLayer(this, setNewBaseLayer);
}
this.map = null;
this.name = null;