Check for outsideViewport - we may not have a parentNode yet.

This commit is contained in:
ahocevar
2012-01-20 16:08:02 +01:00
parent 1d4b68af7b
commit d9cc0c08ed

View File

@@ -169,11 +169,11 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
*/
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
if (this.div.parentNode === this.map.viewPortDiv) {
this.map.events.register("buttonclick", this, this.onButtonClick);
} else {
if (this.outsideViewport) {
this.events.element = this.div;
this.events.register("buttonclick", this, this.onButtonClick);
} else {
this.map.events.register("buttonclick", this, this.onButtonClick);
}
this.addControlsToMap(this.controls);
return this.div;