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:
crschmidt
2006-05-18 03:16:55 +00:00
parent a5d6ad32da
commit aa740e8bca

View File

@@ -167,8 +167,16 @@ OpenLayers.Map.prototype = {
*/
getSize: function () {
// should this be cached?
return new OpenLayers.Size(
var size = new OpenLayers.Size(
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;
},
/**