The FramedCloud popup throws an error if you attempt to call setContentHTML
before you add the popup to the map. To prevent this, don't call construct or updateBlocks if relativePosition is null, to prevent this error message. r=elemoine, (Pullup #1479) git-svn-id: http://svn.openlayers.org/trunk/openlayers@6765 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -248,6 +248,12 @@ OpenLayers.Popup.Framed =
|
||||
* Method: createBlocks
|
||||
*/
|
||||
createBlocks: function() {
|
||||
if (!this.relativePosition) {
|
||||
// this.relativePosition can't be set until we have a map
|
||||
// set: if it's not set, we can't create blocks. (See #1479)
|
||||
return false;
|
||||
}
|
||||
|
||||
this.blocks = [];
|
||||
|
||||
var position = this.positionBlocks[this.relativePosition];
|
||||
@@ -274,6 +280,8 @@ OpenLayers.Popup.Framed =
|
||||
block.div.appendChild(block.image);
|
||||
this.groupDiv.appendChild(block.div);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -283,11 +291,14 @@ OpenLayers.Popup.Framed =
|
||||
* the popup's blocks in their appropropriate places.
|
||||
*/
|
||||
updateBlocks: function() {
|
||||
|
||||
if (!this.blocks) {
|
||||
this.createBlocks();
|
||||
var cont = this.createBlocks();
|
||||
if (!cont) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var position = this.positionBlocks[this.relativePosition];
|
||||
for (var i = 0; i < position.blocks.length; i++) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user