Przeglądaj źródła

'缩放按钮问题修改'

zhangyu 4 lat temu
rodzic
commit
adb151db25

+ 4 - 0
src/components/baseEditer.vue

@@ -538,6 +538,10 @@ export default {
        */
       // TODO: changeScale缩放底图
       bus.$on("changeScale", zoom => {
+        if (zoom == 1) {
+          this.view.fitSceneToView();
+          return;
+        }
         const { scale } = this.view;
         this.changeScaleByClick = true;
         this.view.scaleByPoint(

+ 5 - 1
src/components/edit/top_toolbar.vue

@@ -188,7 +188,11 @@ export default {
       // emit 缩放比例 this.scale / oldScale
       const oldScale = this.scale
       this.scale = Number((oldScale + type * this.scaleStep).toFixed(2))
-      bus.$emit('changeScale', this.scale / oldScale)
+      if ( 0 < oldScale && oldScale < 99) {
+        bus.$emit('changeScale', this.scale / oldScale)
+      } else {
+        bus.$emit('changeScale', 1)
+      }
     },
     FocusItemChanged(itemMsg) {
       this.focusItem = null;