Merge pull request #255 from ahocevar/255
LayerSwitcher broken when rendered to custom div. r=@elemoine
This commit is contained in:
@@ -120,7 +120,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
initialize: function(options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
this.layerStates = [];
|
||||
|
||||
|
||||
if(this.roundedCorner) {
|
||||
OpenLayers.Console.warn('roundedCorner option is deprecated');
|
||||
}
|
||||
@@ -143,6 +143,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
changebaselayer: this.redraw,
|
||||
scope: this
|
||||
});
|
||||
this.events.unregister("buttonclick", this, this.onButtonClick);
|
||||
|
||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
@@ -157,13 +158,18 @@ OpenLayers.Control.LayerSwitcher =
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
|
||||
this.map.events.on({
|
||||
buttonclick: this.onButtonClick,
|
||||
addlayer: this.redraw,
|
||||
changelayer: this.redraw,
|
||||
removelayer: this.redraw,
|
||||
changebaselayer: this.redraw,
|
||||
scope: this
|
||||
});
|
||||
if (this.outsideViewport) {
|
||||
this.events.attachToElement(this.div);
|
||||
this.events.register("buttonclick", this, this.onButtonClick);
|
||||
} else {
|
||||
this.map.events.register("buttonclick", this, this.onButtonClick);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user