Skip to content

Commit 1ef4d4d

Browse files
author
Simon he
committed
chore: update
1 parent bcaccdc commit 1ef4d4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Canvas.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
export class Canvas {
22
canvas: HTMLCanvasElement = document.createElement('canvas')
33
ctx: CanvasRenderingContext2D = this.canvas.getContext('2d')!
4-
constructor() {
4+
constructor(width?: number, height?: number) {
5+
if (width)
6+
this.canvas.width = width
7+
if (height)
8+
this.canvas.height = height
59
return this
610
}
711
}

0 commit comments

Comments
 (0)