fix issue where we try to createblocks without a proper this.relativePosition. Robustness++. (Pullup #1479)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6800 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -248,15 +248,18 @@ 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];
|
||||
//since all positions contain the same number of blocks, we can
|
||||
// just pick the first position and use its blocks array to create
|
||||
// our blocks array
|
||||
var firstPosition = null;
|
||||
for(var key in this.positionBlocks) {
|
||||
firstPosition = key;
|
||||
break;
|
||||
}
|
||||
|
||||
var position = this.positionBlocks[firstPosition];
|
||||
for (var i = 0; i < position.blocks.length; i++) {
|
||||
|
||||
var block = {};
|
||||
@@ -280,8 +283,6 @@ OpenLayers.Popup.Framed =
|
||||
block.div.appendChild(block.image);
|
||||
this.groupDiv.appendChild(block.div);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -292,13 +293,10 @@ OpenLayers.Popup.Framed =
|
||||
*/
|
||||
updateBlocks: function() {
|
||||
if (!this.blocks) {
|
||||
var cont = this.createBlocks();
|
||||
if (!cont) {
|
||||
return false;
|
||||
}
|
||||
this.createBlocks();
|
||||
}
|
||||
|
||||
|
||||
if (this.relativePosition) {
|
||||
var position = this.positionBlocks[this.relativePosition];
|
||||
for (var i = 0; i < position.blocks.length; i++) {
|
||||
|
||||
@@ -336,6 +334,7 @@ OpenLayers.Popup.Framed =
|
||||
|
||||
this.contentDiv.style.left = this.padding.left + "px";
|
||||
this.contentDiv.style.top = this.padding.top + "px";
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Popup.Framed"
|
||||
|
||||
Reference in New Issue
Block a user