diff --git a/lib/OpenLayers/Layer/Google.js b/lib/OpenLayers/Layer/Google.js index 48d516cb89..f48c3f42ae 100644 --- a/lib/OpenLayers/Layer/Google.js +++ b/lib/OpenLayers/Layer/Google.js @@ -212,14 +212,14 @@ OpenLayers.Layer.Google = OpenLayers.Class( * evt - {Event} */ onMapResize: function() { - if(this.visibility) { + // workaround for resizing of invisible or not yet fully loaded layers + // where GMap2.checkResize() does not work. We need to load all tiles + // for the old div size, then checkResize(), and then call + // layer.moveTo() to trigger GMap.setCenter() (which will finish + // the GMap initialization). + if(this.visibility && this.mapObject.isLoaded()) { this.mapObject.checkResize(); } else { - // workaround for resizing of invisible layers where - // GMap2.checkResize() does not work. We need to load all tiles - // for the old div size, then checkResize(), and then call - // layer.moveTo() to trigger GMap.setCenter() (which will finish - // the GMap initialization). if(!this._resized) { var layer = this; var handle = GEvent.addListener(this.mapObject, "tilesloaded", function() {