leaflet.draw 中的 "Cancel" 按钮触发了什么 function/event?
What function/event is fired by the "Cancel" button in leaflet.draw?
我根据 How to click a button and start a new polygon without using the Leaflet.draw UI and How to initiate the draw function without toolbar? 设置了一个自定义按钮来启动绘图。但是,一旦有人点击这个自定义按钮,我就不知道如何模仿 Cancel
按钮的行为,这样我就可以拥有类似
的东西
<input type="button" onclick="stopEdits()" value="Click to Stop Drawing">
function stopEdits() {
//Cancel Drawing
}
所以通过下面的代码解决了这个问题,drawer.disable()
取消了标记放置。
var drawer = new L.Draw.Marker(map, drawControl.options.marker);
function startDrawing() {
drawer.enable();
}
function stopDrawing() {
drawer.disable()
}
我遇到的问题是我之前在同一行中做的太多了:
var drawer = new L.Draw.Marker(map, drawControl.options.marker).enable();
我根据 How to click a button and start a new polygon without using the Leaflet.draw UI and How to initiate the draw function without toolbar? 设置了一个自定义按钮来启动绘图。但是,一旦有人点击这个自定义按钮,我就不知道如何模仿 Cancel
按钮的行为,这样我就可以拥有类似
<input type="button" onclick="stopEdits()" value="Click to Stop Drawing">
function stopEdits() {
//Cancel Drawing
}
所以通过下面的代码解决了这个问题,drawer.disable()
取消了标记放置。
var drawer = new L.Draw.Marker(map, drawControl.options.marker);
function startDrawing() {
drawer.enable();
}
function stopDrawing() {
drawer.disable()
}
我遇到的问题是我之前在同一行中做的太多了:
var drawer = new L.Draw.Marker(map, drawControl.options.marker).enable();