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. */