From b380db25faae576b026d2f4c5b4b026e09c36aef Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Mon, 30 Aug 2021 15:31:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20canvas=20=E8=A7=A6=E5=8F=91=20resize=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=BB=B6=E8=BF=9F=E7=BB=98=E5=9B=BE=E6=97=B6?= =?UTF-8?q?canvas=E5=8F=98=E5=8C=96=20fixed=20#2847?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/components/canvas/index.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/view/components/canvas/index.vue b/src/core/view/components/canvas/index.vue index 4af85af767..a40a897c2f 100644 --- a/src/core/view/components/canvas/index.vue +++ b/src/core/view/components/canvas/index.vue @@ -133,12 +133,13 @@ export default { method(data) } }, - _resize () { + _resize (size) { var canvas = this.$refs.canvas + var hasChanged = !size || (canvas.width !== size.width * pixelRatio || canvas.height !== size.height * pixelRatio) if (canvas.width > 0 && canvas.height > 0) { var context = canvas.getContext('2d') var imageData = context.getImageData(0, 0, canvas.width, canvas.height) - wrapper(canvas) + hasChanged && wrapper(canvas) context.putImageData(imageData, 0, 0) } else { wrapper(canvas) -- GitLab