Sfoglia il codice sorgente

'修改图标属性框宽高比计算'

zhangyu 4 anni fa
parent
commit
36136e7ea4
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      src/components/edit/right_toolbar.vue

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

@@ -195,11 +195,12 @@ export default {
         });
         this.aspectRatio = 1;
       } else {
+        // 属性输入框宽高显示的数值
+        let inputW,inputH;
         this.msgList.forEach(item => {
           const Item = newVal.itemList[0];
           const width = Item.boundingRect().width;
           const height = Item.boundingRect().height;
-          this.aspectRatio = width / height;
           if (item.name == "X") {
             item.msg = Item.mapToScene(
               Item.boundingRect().left,
@@ -224,6 +225,7 @@ export default {
             } else {
               item.disable = true;
             }
+            inputW = item.msg;
           }
           if (item.name == "Height") {
             item.msg = height;
@@ -237,8 +239,10 @@ export default {
             } else {
               item.disable = true;
             }
+            inputH = item.msg;
           }
         });
+        this.aspectRatio = inputW / inputH;
       }
     }
   }