use canvas size when clearing canvas.

This commit is contained in:
Miroslav Šedivý 2023-04-19 11:50:35 +02:00
parent b1f53c81c2
commit a79a5cfd39
2 changed files with 4 additions and 4 deletions

View File

@ -213,7 +213,7 @@
canvasDrawCursor(x: number, y: number, id: string) { canvasDrawCursor(x: number, y: number, id: string) {
// get intrinsic dimensions // get intrinsic dimensions
let { width, height } = this.canvasSize const { width, height } = this.canvasSize
x = Math.round((x / this.screenSize.width) * width) x = Math.round((x / this.screenSize.width) * width)
y = Math.round((y / this.screenSize.height) * height) y = Math.round((y / this.screenSize.height) * height)
@ -246,7 +246,7 @@
// reset transformation, X and Y will be 0 again // reset transformation, X and Y will be 0 again
this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0) this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0)
const { width, height } = this._overlay const { width, height } = this.canvasSize
this._ctx.clearRect(0, 0, width, height) this._ctx.clearRect(0, 0, width, height)
} }
} }

View File

@ -572,7 +572,7 @@
if (this.cursorImage.width <= 1 && this.cursorImage.height <= 1) return if (this.cursorImage.width <= 1 && this.cursorImage.height <= 1) return
// get intrinsic dimensions // get intrinsic dimensions
let { width, height } = this.canvasSize const { width, height } = this.canvasSize
// reset transformation, X and Y will be 0 again // reset transformation, X and Y will be 0 again
this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0) this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0)
@ -619,7 +619,7 @@
// reset transformation, X and Y will be 0 again // reset transformation, X and Y will be 0 again
this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0) this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0)
const { width, height } = this._overlay const { width, height } = this.canvasSize
this._ctx.clearRect(0, 0, width, height) this._ctx.clearRect(0, 0, width, height)
} }