From a05ebaa4ad0bd1e4c003559495776e77897748d9 Mon Sep 17 00:00:00 2001 From: muerwre Date: Thu, 7 Feb 2019 11:32:01 +0700 Subject: [PATCH] fixed clearing polyline --- src/modules/NewPoly.js | 4 ++-- src/utils/EditablePolyline.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) 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([]); } };