From 0ec407ca0449fb2f62a4018744738cc78b956e37 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 7 May 2009 07:49:38 +0000 Subject: [PATCH] use event-based checkResize not only for invisible layers, but also for layers that have not finished loading. r=pgiraud (pullup #2075) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9362 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Google.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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() {