Skip to content

Commit 4e16438

Browse files
authored
fix: vbenjs#2390 [Preview]缩小后scale为负值 (vbenjs#2391)
1 parent c5713c7 commit 4e16438

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Preview/src/Functional.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,16 @@
141141
}
142142
// 缩放函数
143143
function scaleFunc(num: number) {
144+
// 最小缩放
145+
const MIN_SCALE = 0.02;
146+
// 放大缩小的颗粒度
147+
const GRA = 0.1;
144148
if (imgState.imgScale <= 0.2 && num < 0) return;
145-
imgState.imgScale += num;
149+
imgState.imgScale += num * GRA;
150+
// scale 不能 < 0,否则图片会倒置放大
151+
if (imgState.imgScale < 0) {
152+
imgState.imgScale = MIN_SCALE;
153+
}
146154
}
147155
148156
// 旋转图片

0 commit comments

Comments
 (0)