tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 637 forks source link

Support fitBounds options #770

Closed ValentinH closed 9 years ago

ValentinH commented 9 years ago

In Leaflet, the fitBounds is defined like this:

fitBounds( <LatLngBounds> bounds, <fitBounds options> options? )

http://leafletjs.com/reference.html#map-fitboundsoptions but in this directive, there is no way (AFAIK) to specify these options.

Do you think it would be a good idea to support this? I can try to make a pull request.

nmccready commented 9 years ago

There is a way, use leafletData to get the map instance and then set fitBounds. There might not be a current angular way to do it.

ValentinH commented 9 years ago

The goal is to declare it like this in my controller:

{
   markers: {}
   bounds: {
      northEast: {},
      southWest: {},
      options: {
          padding: [50, 50]
      }
   }
}
nmccready commented 9 years ago

Ok, feel free to look at the leaflet.js directive and add it in and make a PR.

ValentinH commented 9 years ago

Ok I'm doing it