Hi.

I think you have two options:

As already suggested, set the maxZoom property of the MapTypes.
You need do this only once - not on each zoom_changed event.

Or listen for the zoom_changed event and if the map's new zoom level
is greater than you desire then set it to your desired level:

google.maps.event.addListener(map, 'zoom_changed', function() {
 var zoomLevel = map.getZoom();
 if (zoomLevel >= 12) {
  map.setZoom(12);
 }
});

If you want to stick with the first option then you need to listen for
an event that'll indicate that the MapType is initialised and ready to
have it's maxZoom property set.

The projection_changed event MIGHT be what you need:

google.maps.event.addListenerOnce(map, 'projection_changed', function()
{
 var myMapTypes=['roadmap', 'satellite', 'hybrid', 'terrain'],
i=myMapTypes.length;
 while(i--){
  map.mapTypes[myMapType[i]].maxZoom=12;
 }
});

That projection_changed event listener is untested code btw, and i'm
not sure if the maxZoom property of each map type is available after
that event is triggered - you'll have to experiment!

Martin.


On Dec 17, 10:55 pm, Christopher Watson
<[email protected]> wrote:
>         var zoomLevel;
>   google.maps.event.addListener(map, 'zoom_changed', function() {
>     zoomLevel = map.getZoom();
>     if (zoomLevel == 12) {
>       map.mapTypes.roadmap.maxZoom(12);
>     }      
>   });
>
> this stops ONE click when try to zoom out. but then lets the second click
> zoom out.
>
> can i stop it from zooming out at all? more if (...)?
>
> http://visualisationmagazine.com/sheffieldcreativemap.htm

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to