【问题标题】:In leaflet/mapbox, why can't I set the duration of `map.fitBounds`?在leaflet/mapbox 中,为什么我不能设置`map.fitBounds` 的持续时间?
【发布时间】:2015-06-09 10:30:01
【问题描述】:

我试过这个:

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

我预计动画需要 10 秒才能完成,但它完成得非常快.. 有没有人知道如何延长 fitBounds 的持续时间?

【问题讨论】:

    标签: gis leaflet mapbox


    【解决方案1】:

    应该设置为:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-29
      • 1970-01-01
      • 2021-10-12
      • 2014-08-20
      • 2017-12-18
      相关资源
      最近更新 更多