From 66a19c70ef190d99c3cffca059763d09f741f37e Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sat, 31 May 2008 17:19:48 +0000 Subject: [PATCH] Fix for GMaps layers to display in correct position when they were originally loaded as the not default layer, or the map is resized while the gmaps layer is hidden. Patch put together by Edgemaster (thanks), (Closes #830) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7300 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Google.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Google.js b/lib/OpenLayers/Layer/Google.js index 9cbfde938e..3fc0c0a590 100644 --- a/lib/OpenLayers/Layer/Google.js +++ b/lib/OpenLayers/Layer/Google.js @@ -189,7 +189,26 @@ OpenLayers.Layer.Google = OpenLayers.Class( * evt - {Event} */ onMapResize: function() { - this.mapObject.checkResize(); + if(this.visibility) { + this.mapObject.checkResize(); + } else { + this.windowResized = true; + } + }, + + /** + * Method: display + * Hide or show the layer + * + * Parameters: + * display - {Boolean} + */ + display: function(display) { + OpenLayers.Layer.EventPane.prototype.display.apply(this, arguments); + if(this.div.style.display == "block" && this.windowResized) { + this.mapObject.checkResize(); + this.windowResized = false; + } }, /**