From 311792e54bda32e06964d7fc54924fcd3c314701 Mon Sep 17 00:00:00 2001 From: liqikun Date: Tue, 28 May 2024 11:43:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=98=E5=88=B6=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=92=A4=E9=94=80=E4=B8=8A=E4=B8=80=E4=B8=AA?= =?UTF-8?q?point?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/polygon/polygon.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/polygon/polygon.ts b/src/polygon/polygon.ts index 67ca5a7..57c76a4 100644 --- a/src/polygon/polygon.ts +++ b/src/polygon/polygon.ts @@ -35,6 +35,25 @@ export default class Polygon extends Base { } } + /** + * backout the last point + */ + removePoint() { + if (this.points.length > 0) { + this.points.pop(); + this.setGeometryPoints(this.points); + if (this.points.length === 2) { + this.addTempLine(); + } else { + this.removeTempLine(); + this.drawPolygon(); + } + if(this.points.length === 0) { + this.removeMoveListener(); + } + } + } + /** * Compare whether the positions of two points are equal. */