Are you sure you're using the latest Leaflet version? I just tried this code in 0.6.4 and it worked perfectly, panning slowly as expected:
map.on('click', function (e) {
map.panTo(e.latlng, {animate: true, duration: 5.0});
});
Frage
The following instruction won't work as I expect:
map.panTo(e.latlng, {animate: true, duration: 1.0});
I've tried different values : 0.5, 1.0, 10.0, 1000.0, 1, 10 but the panning is just as fast!
Any idea? Thanks!
Lösung
Are you sure you're using the latest Leaflet version? I just tried this code in 0.6.4 and it worked perfectly, panning slowly as expected:
map.on('click', function (e) {
map.panTo(e.latlng, {animate: true, duration: 5.0});
});