You could certainly do it programmatically. That's how it's done with the 
scrollwheel, and though I never used the v2 zoomIn method as described, it 
would be how it was done there, too. Basically, you would need to take the 
LatLng you're wanting to zoom around and calculate a new center point based on 
the following formulae:

newCenterLat = givenLat + ((currentCenterLat - givenLat) * Math.pow(.5, 
currentZoom - newZoom));
newCenterLng = givenLng + ((currentCenterLng - givenLng) * Math.pow(.5, 
currentZoom - newZoom));

You would then call something like this:

map.setOptions({
 center : new google.maps.LatLng(newCenterLat, newCenterLng),
 zoom : newZoom
});

And you should zoom in or out around the given point. I.e., the given point 
should remain fixed within your display, regardless of where it is on the map.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
[email protected]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Oct 16, 2011, at 5:30 AM, pinksy wrote:

> Thanks Joseph.
> 
> Is there any way of doing it without the scrollwheel? The zoom option from 
> the context menu in http://maps.google.com/ does it without a scrollwheel.
> 
> Ideally I want to be able to specify a LatLng point programmatically, and 
> call a zoom function to zoom about that point. I noticed that V2 of the API 
> has something similar: GMap2.zoomIn(latlng?:GLatLng, doCenter?:Boolean, 
> doContinuousZoom?:Boolean)
> 
> Cheers
> 
> -- 
> 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/-/7hfiYFWhVwgJ.
> 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.

-- 
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