From 4e16438494df58fbd44d85a2916bd6b0f82ed9e4 Mon Sep 17 00:00:00 2001 From: tnnevol Date: Thu, 17 Nov 2022 23:51:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#2390=20[Preview]=E7=BC=A9=E5=B0=8F?= =?UTF-8?q?=E5=90=8Escale=E4=B8=BA=E8=B4=9F=E5=80=BC=20(#2391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Preview/src/Functional.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Preview/src/Functional.vue b/src/components/Preview/src/Functional.vue index 1c919297..2fcf7e39 100644 --- a/src/components/Preview/src/Functional.vue +++ b/src/components/Preview/src/Functional.vue @@ -141,8 +141,16 @@ } // 缩放函数 function scaleFunc(num: number) { + // 最小缩放 + const MIN_SCALE = 0.02; + // 放大缩小的颗粒度 + const GRA = 0.1; if (imgState.imgScale <= 0.2 && num < 0) return; - imgState.imgScale += num; + imgState.imgScale += num * GRA; + // scale 不能 < 0,否则图片会倒置放大 + if (imgState.imgScale < 0) { + imgState.imgScale = MIN_SCALE; + } } // 旋转图片