We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcaccdc commit 1ef4d4dCopy full SHA for 1ef4d4d
src/Canvas.ts
@@ -1,7 +1,11 @@
1
export class Canvas {
2
canvas: HTMLCanvasElement = document.createElement('canvas')
3
ctx: CanvasRenderingContext2D = this.canvas.getContext('2d')!
4
- constructor() {
+ constructor(width?: number, height?: number) {
5
+ if (width)
6
+ this.canvas.width = width
7
+ if (height)
8
+ this.canvas.height = height
9
return this
10
}
11
0 commit comments