From 99d1979e5634497b749005f1bafe8ac556adb1c7 Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 15 Dec 2020 10:24:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20uni.canvasToTempFil?= =?UTF-8?q?ePath=20=E9=85=8D=E7=BD=AE=E7=9A=84=E5=A4=A7=E5=B0=8F=E8=B6=85?= =?UTF-8?q?=E8=BF=87=20canvas=20=E5=A4=A7=E5=B0=8F=E6=97=B6=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9A=84=E5=9B=BE=E5=83=8F=E7=A9=BA=E7=99=BD=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20question/111225?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/components/canvas/index.vue | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/view/components/canvas/index.vue b/src/core/view/components/canvas/index.vue index 491dc87129..3167fa0035 100644 --- a/src/core/view/components/canvas/index.vue +++ b/src/core/view/components/canvas/index.vue @@ -365,12 +365,10 @@ export default { }) { const canvas = this.$refs.canvas let data - if (!width) { - width = canvas.offsetWidth - x - } - if (!height) { - height = canvas.offsetHeight - y - } + const maxWidth = canvas.offsetWidth - x + width = width ? Math.min(width, maxWidth) : maxWidth + const maxHeight = canvas.offsetHeight - y + height = height ? Math.min(height, maxWidth) : maxHeight if (!hidpi) { if (!destWidth && !destHeight) { destWidth = Math.round(width * pixelRatio) -- GitLab