Răsfoiți Sursa

fix: 约束自动缩放的最大比例

MTrun 3 ani în urmă
părinte
comite
66bcf066e0
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      src/store/modules/chartEditStore/chartEditStore.ts

+ 2 - 2
src/store/modules/chartEditStore/chartEditStore.ts

@@ -133,13 +133,13 @@ export const useChartEditStoreStore = defineStore({
           const scaleWidth = parseFloat(
             ((height * baseProportion) / editCanvasWidth).toFixed(5)
           )
-          this.setScale(parseFloat(scaleWidth.toFixed(5)))
+          this.setScale( scaleWidth > 1 ? 1 : scaleWidth)
         } else {
           // 表示更高
           const scaleHeight = parseFloat(
             (width / baseProportion / editCanvasHeight).toFixed(5)
           )
-          this.setScale(parseFloat(scaleHeight.toFixed(5)))
+          this.setScale(scaleHeight > 1 ? 1 : scaleHeight)
         }
       } else {
         window['$message'].warning('请先创建画布,再进行缩放')