dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
197 stars 47 forks source link

cannot use gm-bounds to fit all markers in map #34

Closed bontorhumala closed 10 years ago

bontorhumala commented 10 years ago

I have make a bounds of type google.map.LatLngBounds using all markers shown in my map (using the extend method). I see that the bounds object is correct, it contains the maxima and minima of my markers coordinates.

I feed the data to options.map.bounds (options.map.bounds = getBounds(); getBounds is a function that returns bounds based on all marker). But the map will not fit the view to my markers. Any other way in angular-gm to fit view based on markers shown in map?

dylanfprice commented 10 years ago

you can use the gm-bounds attribute to bind the map's bounds to a scope variable then all you have to do is set that scope variable to the google.maps.LatLngBounds you want