Just started converting our maps from V2 of the API to v3.
Got one issue so far in that when an InfoWindow is open, and the map is zoomed in, the InfoWindow will move off the map and eventually not be visible, this is different behaviour than in V2. In V2 the InfoWindow remains in view all the time.
Simply click on any marker that is near the edge of the map to open it's InfoWindow, then zoom the map in with the normal zoom controls.
Is there a way to keep the behaviour as in the V2 map?
I did eventually come up with something that works, but it's not great:
var currentInfoWindow = null; // new global scope variable to hold current open infoWindow
In the google.maps.event.addListener(newMarker, "click" function I've added:
currentInfoWindow = this;
Add a zoom_changed listener:
google.maps.event.addListener(theMap, "zoom_changed", function () {
if (currentInfoWindow != null) {
infoWindow.open(theMap, currentInfoWindow);
} });
and an infoWindow closeclick listener:
google.maps.event.addListener(infoWindow, "closeclick", function () {
currentInfoWindow = null;});
Can be seen here:
It works but it's not great, get some panning when zooming in, and when the marker is at the bottom of the map it is right at the bottom!
Has anyone got any ideas for a better solution?
Cheers,
Mike