fall back to Element.getDimensions when the element has no size (such as when it's hidden).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@117 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -167,8 +167,16 @@ OpenLayers.Map.prototype = {
|
|||||||
*/
|
*/
|
||||||
getSize: function () {
|
getSize: function () {
|
||||||
// should this be cached?
|
// should this be cached?
|
||||||
return new OpenLayers.Size(
|
var size = new OpenLayers.Size(
|
||||||
this.div.clientWidth, this.div.clientHeight);
|
this.div.clientWidth, this.div.clientHeight);
|
||||||
|
|
||||||
|
// Workaround for the fact that hidden elements return 0 for size.
|
||||||
|
if (size.w == 0 && size.h == 0) {
|
||||||
|
var elementSize = Element.getDimensions(this.div);
|
||||||
|
size.w = elementSize.width;
|
||||||
|
size.h = elementSize.height;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user