我又卡住了。放置标记并连接它们正在工作。感谢“Falke Design” :-) 现在我想删除最后一个标记(航点),当我点击“删除最后一个航点”按钮时。我设法做到了并且工作得很好,但最后一行没有被删除。完整代码您可以在这里找到: 演示代码
此问题应在函数 delteLastWp() 第 218 行中
function delteLastWp(id) {
var new_markers = []
marker_new.forEach(function(marker) {
if (marker._id == id) {
map.removeLayer(marker);
}
else new_markers.push(marker)
})
marker_new = new_markers
// remove the last point/line in the polyline as well !
var new_polylines = []
tempLine.forEach(function(polyline) {
if (polyline._id == id) {
map.removeLayer(polyline); //*** This si not working ****
// remove the last point in the polyline as well !
}
else new_polylines.push(polyline)
})
}
请帮我!非常感谢你:-)