I wrote the following function to to fit visible all pushpins(Auto
zoom to fit all pushpins) along user's location @ center
but problem is " googleMap.setCenter(userPinLoc);" makes few pins out
of view port.
I can i set fitbounds and telling that "userPinLoc" must be center and
rest of around also visible.
function setInitialZoom() {
mapZoom = googleMap.getZoom();
var bounds = new google.maps.LatLngBounds();
bounds.extend(userPinLoc);
for (i in nearestEntitiesToZoom) {
entity = nearestEntitiesToZoom[i];
var googleLatLng = new
google.maps.LatLng(entity.latitude,entity.longitude);
bounds.extend(googleLatLng);
}
google.maps.event.addDomListener(googleMap, 'bounds_changed',
function() {
googleMap.setCenter(userPinLoc);
});
googleMap.fitBounds(bounds);
}
--
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.