From 61adc97637d027fb14687c57d8b5fa59280b68e4 Mon Sep 17 00:00:00 2001 From: QuadFlask Date: Sat, 6 Mar 2021 22:25:13 +0900 Subject: [PATCH] feat: make `undo`, `clear` return paths (#351) --- packages/core/src/drawing.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/drawing.ts b/packages/core/src/drawing.ts index 3f7eb4017..82ec5b118 100644 --- a/packages/core/src/drawing.ts +++ b/packages/core/src/drawing.ts @@ -67,14 +67,17 @@ export class SvgDrawing extends Renderer { this.on() } - public clear(): void { + public clear(): Path[] { + const paths = this.paths this.paths = [] this.update() + return paths } - public undo(): void { - this.paths.pop() + public undo(): Path | undefined { + const path = this.paths.pop() this.update() + return path } public changeDelay(delay: number): void {