我目前正在使用leaflet.js,并且现在正在网上搜索相当多的东西,以查明:如果有事件,那么可以在异步函数setView()的动画结束后触发该事件。leaflet.js:setView()完成动画时触发事件。这怎么可能?
这是我的尝试:
map.setView([lat, lon ], 12 , {
pan: { animate: true , duration: 0.5 },
zoom: { animate: true },
animate: true
}.on('ready', function(e) {
console.log("animation finished!");
});
的的setView命令的作品完美,但功能,应该在地图动画准备好了,不工作被解雇。
有没有人有解决方案?
我认为这是[once](http://leafletjs.com/reference-1.0.3.html#evented-once) – Jacob