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!

有帮助吗?

解决方案

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});
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top