在leaflet/mapbox中,为什么我不能设置`map.fitBounds`的持续时间?
In leaflet/mapbox, why can't I set the duration of `map.fitBounds`?
我试过这个:
map.fitBounds(L.polyline([L.latLng(40,9), L.latLng(1,2)]).getBounds(), {
padding: [50, 50],
maxZoom: 17,
animate: true,
duration: 10
});
我预计动画需要 10 秒才能完成,但它完成得非常快。有没有人知道如何延长 fitBounds
的持续时间?
应设置为:
map.fitBounds(bounds, {
padding: [50, 50],
maxZoom: 18,
animate: true,
pan: {
duration: 10
}
});
我试过这个:
map.fitBounds(L.polyline([L.latLng(40,9), L.latLng(1,2)]).getBounds(), {
padding: [50, 50],
maxZoom: 17,
animate: true,
duration: 10
});
我预计动画需要 10 秒才能完成,但它完成得非常快。有没有人知道如何延长 fitBounds
的持续时间?
应设置为:
map.fitBounds(bounds, {
padding: [50, 50],
maxZoom: 18,
animate: true,
pan: {
duration: 10
}
});