So you basically want a fitBounds method that maintains the map center point? You would need to loop through all your markers and find the farthest latitude & longitude (may not be from the same marker) from your center. You would then need to calculate an opposing latitude/ longitude of equal distance on the opposite side of your center point, then you could call the map.fitBounds method with these points as your bounds.
Chad Killingsworth On Jun 18, 6:57 am, olivier <[email protected]> wrote: > Well for instance, in the code i posted, the map has no marker in the > begining. I click to put a marker, just one inside the original > viewport, and the map zooms out ! I'd like to have a zoom out when all > the markers don't fit the viewport. > And yes, maybe there's a trick whith references using some functions, > but i'm not very familiar with that, if that's the kind of bug. > > On 18 juin, 12:16, Rossko <[email protected]> wrote: > > > > > > the zoom doesn't fit optimally the map. > > > I'm not sure exactly what effect you want, but at the moment you get > > the bounds of the map in display, and add-in the new marker. > > Perhaps you are looking for an effect more like where you keep a > > bounds object of the existing marker(s) and add-in the new marker, > > without reference to the current map display? -- 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.
