In a sheet / file cabinet, why can't I set the duration of `map.fitBounds`?

I've tried this:

map.fitBounds(L.polyline([L.latLng(40,9), L.latLng(1,2)]).getBounds(), {
  padding: [50, 50],
  maxZoom: 17,
  animate: true,
  duration: 10
});

      

I expect the animation to take 10 seconds, but it will complete very quickly. Anyone have any ideas on how to extend the duration for fitBounds

?

+3


source to share


1 answer


It should be installed as:



map.fitBounds(bounds, {
    padding: [50, 50],
    maxZoom: 18,
    animate: true,
    pan: {
        duration: 10
    }
});

      

+4


source







All Articles