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
|
* Method: createBlocks
|
||||||
*/
|
*/
|
||||||
createBlocks: function() {
|
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 = [];
|
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++) {
|
for (var i = 0; i < position.blocks.length; i++) {
|
||||||
|
|
||||||
var block = {};
|
var block = {};
|
||||||
@@ -280,8 +283,6 @@ OpenLayers.Popup.Framed =
|
|||||||
block.div.appendChild(block.image);
|
block.div.appendChild(block.image);
|
||||||
this.groupDiv.appendChild(block.div);
|
this.groupDiv.appendChild(block.div);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,13 +293,10 @@ OpenLayers.Popup.Framed =
|
|||||||
*/
|
*/
|
||||||
updateBlocks: function() {
|
updateBlocks: function() {
|
||||||
if (!this.blocks) {
|
if (!this.blocks) {
|
||||||
var cont = this.createBlocks();
|
this.createBlocks();
|
||||||
if (!cont) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.relativePosition) {
|
||||||
var position = this.positionBlocks[this.relativePosition];
|
var position = this.positionBlocks[this.relativePosition];
|
||||||
for (var i = 0; i < position.blocks.length; i++) {
|
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.left = this.padding.left + "px";
|
||||||
this.contentDiv.style.top = this.padding.top + "px";
|
this.contentDiv.style.top = this.padding.top + "px";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Popup.Framed"
|
CLASS_NAME: "OpenLayers.Popup.Framed"
|
||||||
|
|||||||
Reference in New Issue
Block a user