[OpenLayers-Commits] r11581 - trunk/openlayers/lib/OpenLayers/Layer/Google

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Feb 28 07:55:42 EST 2011


Author: ahocevar
Date: 2011-02-28 04:55:40 -0800 (Mon, 28 Feb 2011)
New Revision: 11581

Modified:
   trunk/openlayers/lib/OpenLayers/Layer/Google/v3.js
Log:
fixing issue with maps disappearing on resize. r=crschmidt (closes #2828)

Modified: trunk/openlayers/lib/OpenLayers/Layer/Google/v3.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/Google/v3.js	2011-02-28 12:33:52 UTC (rev 11580)
+++ trunk/openlayers/lib/OpenLayers/Layer/Google/v3.js	2011-02-28 12:55:40 UTC (rev 11581)
@@ -181,15 +181,16 @@
         if (this.visibility) {
             google.maps.event.trigger(this.mapObject, "resize");
         } else {
-            if (!this._resized) {
+            var cache = OpenLayers.Layer.Google.cache[this.map.id];
+            if (!cache.resized) {
                 var layer = this;
                 google.maps.event.addListenerOnce(this.mapObject, "tilesloaded", function() {
-                    delete layer._resized;
                     google.maps.event.trigger(layer.mapObject, "resize");
                     layer.moveTo(layer.map.getCenter(), layer.map.getZoom());
+                    delete cache.resized;
                 });
             }
-            this._resized = true;
+            cache.resized = true;
         }
     },
 
@@ -202,7 +203,7 @@
      */
     setGMapVisibility: function(visible) {
         var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        if (cache) {
+        if (cache && !cache.resized) {
             var type = this.type;
             var layers = this.map.layers;
             var layer;



More information about the Commits mailing list