[英]Catch Motion End event in Leaflet Motion Plugin
我目前正在使用 leaflet、leaflet 动画插件来制作折线动画。
现在我需要在 animation 动作完成后显示一个弹出窗口。
我怎样才能赶上运动结束事件。
从文档中,我可以看到 L.Motion.Event.Ended 事件将在动作结束后触发。
但是我无法获得此动作结束事件。
任何人都可以帮助捕捉 leaflet 运动中的运动结束事件。
刚刚弄明白了。 创建动作 object 后,您可以像这样收听它:
var route = L.motion.polyline(pol, {
color: "steelblue",// + Math.floor(Math.random()*16777215).toString(16),
weight:4
},
{
auto:false,
duration:this.route_speed
},
{
removeOnEnd: true,
icon: L.divIcon({
className: 'custom-div-icon',
html: "<i class='fas fa-map-pin' style='color:red; font-size: 20px;'></i>",
iconSize: [30, 42],
iconAnchor: [5, 20]
})
}).addTo(this.map);
this.routes.push(route);
route.on('motion-started', (e) => {
console.log("START")
})
route.on('motion-ended', (e) => {
console.log("END")
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.