Ticket #3409 (new bug)

Opened 2 years ago

Last modified 21 months ago

trunk google-v3 problem resizing and switching layers & fix

Reported by: collinsp Owned by:
Priority: major Milestone: 2.13 Release
Component: Layer.Google.v3 Version: 2.11 RC1
Keywords: Cc: collinsp
State: Review

Description

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);
};

Change History

Changed 2 years ago by collinsp

  • cc collinsp added

Changed 2 years ago by tschaub

ICLA  received. Thanks.

Changed 23 months ago by crschmidt

  • milestone changed from 2.11 Release to 2.12 Release

Changed 21 months ago by fredj

  • type changed from feature to bug

Changed 21 months ago by fredj

see #3475

Changed 21 months ago by bartvde

@collinsp: does the fix for #3475 also solve your issue?

Note: See TracTickets for help on using tickets.