简体   繁体   English

如何将事件侦听器绑定到编辑工具栏中的“全部清除”按钮?

[英]How do I bind an event listener to Clear All button in the edit toolbar?

Leaflet-draw allows users to create a draw control that comes with an edit and delete button for the layers. Leaflet-draw允许用户创建一个绘图控件,该控件带有用于图层的“编辑”和“删除”按钮。

For the delete button, there are three sub-buttons: Save, Cancel and Clear All. 对于删除按钮,有三个子按钮:保存,取消和全部清除。 I want to bind my custom event to the Clear All button. 我想将自定义事件绑定到“全部清除”按钮。 I went through the documentation for Leaflet and could not find anything about binding events to draw controls buttons. 我浏览了Leaflet的文档,但找不到有关绑定事件以绘制控件按钮的任何信息。

map.on('click:clearall', function () {
    //do something
})

Clear All is supposed to fire an event that allows me to delete dynamic elements associated with the created layers. 清除全部应该触发一个事件,该事件使我可以删除与创建的图层关联的动态元素。 Instead, the dynamic elements remained while the layers are deleted. 而是在删除图层时保留动态元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM