diff --git a/src/modules/NewPoly.js b/src/modules/NewPoly.js index caa2b1f..95326c9 100644 --- a/src/modules/NewPoly.js +++ b/src/modules/NewPoly.js @@ -139,8 +139,8 @@ export class NewPoly { }; clearAll = () => { - this.poly.setLatLngs([]); - this.poly.editor.reset(); + // this.poly.setLatLngs([]); + this.poly.editor.clear(); this.updateMarks(); }; diff --git a/src/utils/EditablePolyline.js b/src/utils/EditablePolyline.js index 4d48ca5..7ad4ad3 100644 --- a/src/utils/EditablePolyline.js +++ b/src/utils/EditablePolyline.js @@ -112,6 +112,10 @@ L.Polyline.polylineEditor = L.Polyline.extend({ } this._reloadPolyline(); + }, + + clear: () => { + this.setPoints([]); } };