Commit 4e16438494df58fbd44d85a2916bd6b0f82ed9e4
Committed by
GitHub
1 parent
c5713c75
fix: #2390 [Preview]缩小后scale为负值 (#2391)
Showing
1 changed file
with
9 additions
and
1 deletions
src/components/Preview/src/Functional.vue
... | ... | @@ -141,8 +141,16 @@ |
141 | 141 | } |
142 | 142 | // 缩放函数 |
143 | 143 | function scaleFunc(num: number) { |
144 | + // 最小缩放 | |
145 | + const MIN_SCALE = 0.02; | |
146 | + // 放大缩小的颗粒度 | |
147 | + const GRA = 0.1; | |
144 | 148 | 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 | + } | |
146 | 154 | } |
147 | 155 | |
148 | 156 | // 旋转图片 | ... | ... |