From a79a5cfd3963ede8e6d3072e6d1b73db4c1df0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Wed, 19 Apr 2023 11:50:35 +0200 Subject: [PATCH] use canvas size when clearing canvas. --- src/component/cursors.vue | 4 ++-- src/component/overlay.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/component/cursors.vue b/src/component/cursors.vue index dfce399c..d2261bf1 100644 --- a/src/component/cursors.vue +++ b/src/component/cursors.vue @@ -213,7 +213,7 @@ canvasDrawCursor(x: number, y: number, id: string) { // get intrinsic dimensions - let { width, height } = this.canvasSize + const { width, height } = this.canvasSize x = Math.round((x / this.screenSize.width) * width) y = Math.round((y / this.screenSize.height) * height) @@ -246,7 +246,7 @@ // reset transformation, X and Y will be 0 again 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) } } diff --git a/src/component/overlay.vue b/src/component/overlay.vue index fc3270ca..7a2b7a1c 100644 --- a/src/component/overlay.vue +++ b/src/component/overlay.vue @@ -572,7 +572,7 @@ if (this.cursorImage.width <= 1 && this.cursorImage.height <= 1) return // get intrinsic dimensions - let { width, height } = this.canvasSize + const { width, height } = this.canvasSize // reset transformation, X and Y will be 0 again this._ctx.setTransform(this.canvasScale, 0, 0, this.canvasScale, 0, 0) @@ -619,7 +619,7 @@ // reset transformation, X and Y will be 0 again 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) }