【发布时间】:2016-08-30 14:12:37
【问题描述】:
我有一张地图,上面画了一个圆圈,放在地图的中心。圆圈始终出现在地图上。圆的半径可由用户调整。在每次半径变化时,我都会像这样调用 fitBounds:
leafletData.getMap().then(function(map){
var currentDiameter = L.circle(map.getCenter(), $scope.radius);
map.fitBounds(currentDiameter.getBounds());
});
有时 fitBounds 会移动地图的中心。我尝试在每次 fitBounds 调用后重新定位地图,但这并不理想。
提前致谢
【问题讨论】:
标签: leaflet angular-leaflet-directive