From 666193618854e6b457e1751b17c80e92d14c6646 Mon Sep 17 00:00:00 2001 From: Emma Date: Mon, 23 Oct 2023 14:09:18 -0600 Subject: [PATCH] clearing --- canvas.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/canvas.ts b/canvas.ts index 84d01db..c58af53 100644 --- a/canvas.ts +++ b/canvas.ts @@ -81,6 +81,7 @@ export class Doodler { } protected draw() { + this.ctx.clearRect(0, 0, this.width, this.height); this.ctx.fillStyle = this.bg; this.ctx.fillRect(0, 0, this.width, this.height); // for (const d of this.draggables.filter(d => d.beingDragged)) { @@ -245,6 +246,10 @@ export class Doodler { this.ctx.strokeText(text, pos.x, pos.y, maxWidth); } + clearRect(at: Vector, width: number, height: number) { + this.ctx.clearRect(at.x, at.y, width, height); + } + // Interaction mouseX = 0;