Finally managed to do it. For those who're interested :
maxZoom = 19;
minZoom = 13;
google.maps.event.addListener(map, 'zoom_changed', function(){
if(map.getZoom() < maxZoom){
map.setZoom(maxZoom);
}else if(map.getZoom() > minZoom){
map.setZoom(minZoom);
}
});
On 23 sep, 14:46, korky <[email protected]> wrote:
> Hi, I'm new at coding with the API V3 and I'm actually trying to set
> maxZoom and minZoom values on my map, but can't find any way to do it.
> The point of this would be to restrict the user to a max and a min
> zoom on the map, thus if he reaches the value of maxZoom he can't
> scroll further and the same for minZoom.
>
> It must be kind of by using MapType ? But where do I declare all this
> stuff?
>
> Thanks.
>
> By the way, this is a part of my actual code, I guess I would've to
> declare the max and min Zoom nearby?
>
> function initialize()
> {
> geocoder = new google.maps.Geocoder();
>
> var mapCenter = new google.maps.LatLng(arrMapOptions[0].lat,
> arrMapOptions[0].lng);
> var mapOptions = {
> zoom: arrMapOptions[0].zoom,
> center: mapCenter,
> mapTypeId: google.maps.MapTypeId.ROADMAP
> };
>
> map = new google.maps.Map(document.getElementById('mapcanvas'),
> mapOptions);
>
> }
>
>
--
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.