From a4aa5b7cc478c4be7de670e7d4bbb2778ddfc33d Mon Sep 17 00:00:00 2001 From: Eric Xu Date: Wed, 10 Jul 2024 22:17:38 -0400 Subject: [PATCH] Fix unexpected behavior when zooming Waiting for the sweep animation to finish fixes this issue. Fixes #6 --- src/lib/MazeDrawer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/MazeDrawer.ts b/src/lib/MazeDrawer.ts index 2be721f..68b64df 100644 --- a/src/lib/MazeDrawer.ts +++ b/src/lib/MazeDrawer.ts @@ -156,7 +156,8 @@ export default class MazeDrawer { this.fillWithWall(); } - public zoomTo(zoomLevel: number): void { + public async zoomTo(zoomLevel: number): Promise { + await this.waitForSweepAnimations(); this.zoomLevel = zoomLevel; this.updateCanvasSize(); const redraw = () => {