[OpenLayers-Dev] trunk google-v3 problem resizing and switching layers & fix

Olivier terral olivier.terral at geomatys.fr
Wed Jul 13 08:26:50 EDT 2011


Hi Philip,

You should create a ticket to be sure the commiters see the fix, review 
it and  add it in the future 2.11 release.

Thanks for the fix, it works for me.

Here some infos :

http://trac.osgeo.org/openlayers/wiki/HowToContribute
http://trac.osgeo.org/openlayers/wiki/FilingTickets
http://trac.osgeo.org/openlayers/wiki/CreatingPatches


On 11/07/2011 21:39, Philip Collins wrote:
> Go to:
> http://openlayers.org/dev/examples/google-v3.html
>
> and make your browser window really skinny. Then try to switch the base
> layer. Nothing happens. Then try to make your browser a normal size and
> switch layers. Still nothing happens.
>
> The problem is that the current code is relying upon google sending a
> tiles loaded event that never occurs. Here's some code to fix that.
>
> // patch openlayers 2.11RC to fix problem when switching to a google 
> layer
> from a non google layer after resizing the map
> OpenLayers.Layer.Google.v3.onMapResize = function() {
>    var cache = OpenLayers.Layer.Google.cache[this.map.id];
>    cache.resized = true;
> };
> OpenLayers.Layer.Google.v3.setGMapVisibility_old =
> OpenLayers.Layer.Google.v3.setGMapVisibility;
> OpenLayers.Layer.Google.v3.setGMapVisibility = function(visible) {
>    var cache = OpenLayers.Layer.Google.cache[this.map.id];
>    if (visible&&  cache&&  cache.resized) {
>      google.maps.event.trigger(this.mapObject, "resize");
>      delete cache.resized;
>    }
>    
> OpenLayers.Layer.Google.v3.setGMapVisibility_old.apply(this,arguments);
> };
>
> Phil
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110713/a76e1546/attachment.html


More information about the Dev mailing list