Skip to content

Commit

Permalink
Delete previous canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
Jumbub committed Mar 30, 2022
1 parent db5554e commit 09e3a15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/graphics/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
let lastCanvas: HTMLCanvasElement;

export const newContext = (viewWidth: number, viewHeight: number) => {
if (lastCanvas) lastCanvas.remove();

const canvas = document.createElement('canvas');
canvas.width = viewWidth + 2;
canvas.height = viewHeight + 2;
Expand Down

0 comments on commit 09e3a15

Please sign in to comment.