在fitBounds上调用Zoomend事件

时间:2019-05-30 08:50:37

标签: leaflet fitbounds

我正在使用传单库来渲染地图。我在zoomend事件中保存了地图的视图范围,并将其应用于渲染地图。由于此绑定值的应用正在发生变化。

在zoomBounds对象中捕获地图视图范围。

mymap.on('zoomend', function(event) {
   zoomBounds = event.target.getBounds();   
});

将边界应用于地图:

mymap.fitBounds(zoomBounds);

但这又是调用zoomend事件,并且zoomBounds再次被更新为新值。

0 个答案:

没有答案