In order to overcome the "info window closes on zoom with
MarkerManager" issue, I've done the following:
1) added an ID to all GMarker objects.
2) created an array of objects, indexed by the ID of the marker it's
associated with, containing the infoWindow location, offset, size, and
tabs, as well as the min/maxZoom for which the marker is displayed.
3) Bound the map's click event to the function onMapClick below.
(simplified for posting)
4) Bound the map's zoomend event to the function onMapZoom below.
(simplified for posting)

onMapClick(overlay, LatLng, overlayLatLng){
  if(overlay!=null){
    var info = map.getInfoWindow();
    var toOpen = infoWindows[overlay.ID];
    if(toOpen!=null && map.getZoom()>=toOpen.minZoom && map.getZoom()
<=toOpen.maxZoom){
      info.reset(toOpen.point, toOpen.tabs, toOpen.size,
toOpen.offset, 0);
      info.show();

      openInfoID = overlay.ID;
    } else {
      info.hide();

      openInfoID = null;
    }
  }
}

onMapZoom(oldZ, newZ){
  if(openInfoID!=null){
    var info = map.getInfoWindow();
    var toOpen = infoWindows[openInfoID];
    if(toOpen!=null && map.getZoom()>=toOpen.minZoom && map.getZoom()
<=toOpen.maxZoom){
      info.reset(toOpen.point, toOpen.tabs, toOpen.size,
toOpen.offset, 0);
      info.show();
    } else {
      info.hide();
    }
  }
}

Now, this all works great.  However, I've noticed an unintentional
side effect of associating an info window to a marker (without
MarkerManager); namely that when the zoom is changed via the
GLargeMapControl(), with an info window open, the map center is
changed so that the marker and infoWindow are fixed within the view
pane.  This is not the case with my new code, instead the map center
is the fixed point.

The best idea I've come up with to duplicate this behavior is a lot of
math figuring out the infoWindows relative location within the view
pane and then setting the center in the onMapZoom function.  but this
would then occur regardless of the method of invoking the zoom,
including the ScrollWheelZoom and DoubleClickZoom, and I want those to
continue functioning as they do.

Any suggestions/help are greatly appreciated.
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to