Use goog.style.getSize to compute the map size.

This allows to initialize hidden map (display: none).
Otherwise the size is 0 (clientWidth == clientHeight == 0)
This commit is contained in:
Frederic Junod
2013-03-05 18:44:34 +01:00
parent 59271ae2d8
commit de168e0fb0

View File

@@ -20,6 +20,7 @@ goog.require('goog.events.KeyHandler');
goog.require('goog.events.KeyHandler.EventType');
goog.require('goog.events.MouseWheelHandler');
goog.require('goog.events.MouseWheelHandler.EventType');
goog.require('goog.style');
goog.require('ol.BrowserFeature');
goog.require('ol.Collection');
goog.require('ol.Color');
@@ -556,8 +557,8 @@ ol.Map.prototype.handleBackgroundColorChanged_ = function() {
* @protected
*/
ol.Map.prototype.handleBrowserWindowResize = function() {
var size = new ol.Size(this.target_.clientWidth, this.target_.clientHeight);
this.setSize(size);
var size = goog.style.getSize(this.target_);
this.setSize(new ol.Size(size.width, size.height));
};