yx 4 years ago
parent
commit
a6b9cddbcd
1 changed files with 72 additions and 68 deletions
  1. 72 68
      src/components/edit/right_toolbar.vue

+ 72 - 68
src/components/edit/right_toolbar.vue

@@ -15,9 +15,9 @@
                                 :suffix="item.unit"
                             />
                         </li>
-                        <li @click="lockItem" :title="isLock?'锁定':'解锁'">
+                        <!-- <li @click="lockItem" :title="isLock?'锁定':'解锁'">
                             <Icon style="vertical-align: middle;" :name="isLock?'lock':'unlock'" />
-                        </li>
+                        </li> -->
                     </ul>
                     <!-- 设备 item 属性值组件 -->
                     <equipmentAttr :key="eqKey" v-if="attrType === 'Equipment'" :focusItemList="focusItemList"/>
@@ -67,12 +67,12 @@ const msgList = [
         name: "Y",
         unit: "y"
     },
-    {
-        msg: "0°",
-        disable: true,
-        name: "",
-        unit: ""
-    },
+    // {
+    //     msg: "0°",
+    //     disable: true,
+    //     name: "",
+    //     unit: ""
+    // },
     {
         msg: "",
         disable: true,
@@ -199,67 +199,71 @@ export default {
             this.attrType = newVal.itemType;
             this.infoKey++
             this.eqKey++
-            // if (newVal.itemList.length !== 1) {
-            //     this.msgList.forEach(item => {
-            //         if (item.name == "X") {
-            //             item.msg = 0;
-            //         }
-            //         if (item.name == "Y") {
-            //             item.msg = 0;
-            //         }
-            //         if (item.name == "Width") {
-            //             item.msg = 0;
-            //         }
-            //         if (item.name == "Height") {
-            //             item.msg = 0;
-            //         }
-            //     });
-            //     this.aspectRatio = 1;
-            // } else {
+            if (newVal.itemList.length !== 1) {
+                this.msgList.forEach(item => {
+                    if (item.name == "X") {
+                        item.msg = 0;
+                    }
+                    if (item.name == "Y") {
+                        item.msg = 0;
+                    }
+                    if (item.name == "Width") {
+                        item.msg = 0;
+                    }
+                    if (item.name == "Height") {
+                        item.msg = 0;
+                    }
+                });
+                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;
-            //         if (item.name == "X") {
-            //             item.msg = Item.mapToScene(Item.boundingRect().left, Item.boundingRect().top).x;
-            //         }
-            //         if (item.name == "Y") {
-            //             item.msg = Item.mapToScene(Item.boundingRect().left, Item.boundingRect().top).y;
-            //         }
-            //         if (item.name == "Width") {
-            //             item.msg = width;
-            //             // Icon显示图片宽
-            //             if (Item instanceof SImageLegendItem) {
-            //                 item.msg = Item.img.width;
-            //             }
-            //             // 针对图片及Icon
-            //             if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
-            //                 item.disable = false;
-            //             } else {
-            //                 item.disable = true;
-            //             }
-            //             inputW = item.msg;
-            //         }
-            //         if (item.name == "Height") {
-            //             item.msg = height;
-            //             // Icon显示图片高
-            //             if (Item instanceof SImageLegendItem) {
-            //                 item.msg = Item.img.height;
-            //             }
-            //             // 针对图片及Icon
-            //             if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
-            //                 item.disable = false;
-            //             } else {
-            //                 item.disable = true;
-            //             }
-            //             inputH = item.msg;
-            //         }
-            //     });
-            //     this.aspectRatio = inputW / inputH;
-            // }
+                // 属性输入框宽高显示的数值
+                let inputW, inputH;
+                this.msgList.forEach(item => {
+                    const Item = newVal.itemList[0];
+                    const width = Item.boundingRect().width;
+                    const height = Item.boundingRect().height;
+                    if (item.name == "X") {
+                        item.msg = Item.mapToScene(Item.boundingRect().left, Item.boundingRect().top).x;
+                    }
+                    if (item.name == "Y") {
+                        item.msg = Item.mapToScene(Item.boundingRect().left, Item.boundingRect().top).y;
+                    }
+                    if (item.name == "Width") {
+                        item.msg = width;
+                        // Icon显示图片宽
+                        if (Item instanceof SImageLegendItem) {
+                            item.msg = Item.img.width;
+                        }
+                        // 针对图片及Icon
+                        if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
+                            // TODO: 放开设备类修改宽高
+                        // if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem  || Item instanceof SEquipmentItem) {
+                            item.disable = false;
+                        } else {
+                            item.disable = true;
+                        }
+                        inputW = item.msg;
+                    }
+                    if (item.name == "Height") {
+                        item.msg = height;
+                        // Icon显示图片高
+                        if (Item instanceof SImageLegendItem) {
+                            item.msg = Item.img.height;
+                        }
+                        // 针对图片及Icon
+                        if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
+                            // TODO: 放开设备类修改宽高
+                        // if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem || Item instanceof SEquipmentItem) {
+                            item.disable = false;
+                        } else {
+                            item.disable = true;
+                        }
+                        inputH = item.msg;
+                    }
+                });
+                this.aspectRatio = inputW / inputH;
+            }
         }
     }
 };