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