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.

V2 map: http://www.stroud.gov.uk/docs/housing/tenant_map.asp

V3 map: http://www.stroud.gov.uk/docs/housing/tenant_map_v3.asp

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:
http://www.stroud.gov.uk/docs/housing/tenant_map_v3_fix.asp

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

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/is3zt5Px2jQJ.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to