YaolongHan vor 4 Jahren
Ursprung
Commit
4228727b29

+ 1 - 1
src/components/edit/attr_select.vue

@@ -150,7 +150,7 @@ export default {
       fontSize: 12, //字体大小
       lineWidth: 0,
       color: "", //字体颜色
-      textMsg: "" //
+      textMsg: "", //
     };
   },
   methods: {

+ 42 - 20
src/components/edit/right_toolbar.vue

@@ -17,7 +17,7 @@
                 alt
               />
             </li>
-          </ul> -->
+          </ul>-->
           <ul class="position">
             <li v-for="(item,i) in msgList" :key="i">
               <a-input
@@ -32,7 +32,7 @@
               <img class="lock" :src="require(`./../../assets/images/t-lock.png`)" alt />
             </li>
           </ul>
-          <attrSelect :type="attrType" :focusItemList="focusItemList"/>
+          <attrSelect :type="attrType" :focusItemList="focusItemList" />
         </div>
       </a-tab-pane>
       <a-tab-pane key="2" tab="元素" force-render>
@@ -158,27 +158,49 @@ export default {
     callback(key) {
       console.log(key);
     },
-    onSearch() {},
+    onSearch() {}
   },
   watch: {
     focusItemList: function(newVal) {
-      this.attrType = newVal.itemType ?  newVal.itemType : "choice"
-      // this.msgList.forEach(item => {
-      //   if (item.name == "X") {
-      //     item.msg = newVal[0].minX;
-      //     // item.msg = newVal[0].mapToScene(0, 0).x;
-      //   }
-      //   if (item.name == "Y") {
-      //     item.msg = newVal[0].minY;
-      //     // item.msg = newVal[0].mapToScene(0, 0).y;
-      //   }
-      //   if (item.name == "Width") {
-      //     item.msg = newVal[0].boundingRect().width;
-      //   }
-      //   if (item.name == "Height") {
-      //     item.msg = newVal[0].boundingRect().height;
-      //   }
-      // });
+      this.attrType = newVal.itemType;
+      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;
+          }
+        });
+      } else {
+        this.msgList.forEach(item => {
+          const Item = newVal.itemList[0];
+          if (item.name == "X") {
+            item.msg = Item.mapToScene(
+              Item.pos.x + Item.boundingRect().x,
+              Item.pos.y + Item.boundingRect().y
+            ).x;
+          }
+          if (item.name == "Y") {
+            item.msg = Item.mapToScene(
+              Item.pos.x + Item.boundingRect().x,
+              Item.pos.y + Item.boundingRect().y
+            ).y;
+          }
+          if (item.name == "Width") {
+            item.msg = Item.boundingRect().width;
+          }
+          if (item.name == "Height") {
+            item.msg = Item.boundingRect().height;
+          }
+        });
+      }
     }
   }
 };

+ 30 - 4
src/components/mapClass/editScence.ts

@@ -62,7 +62,7 @@ export class EditScence extends SGraphScene {
             itemType = 'pipeline'
         } else if (obj.itemList[0] instanceof SImgTextItem) {
             itemType = 'equipment'
-        }else{
+        } else {
             itemType = ''
         };
         if (obj.itemList.length == 1) {
@@ -188,7 +188,7 @@ export class EditScence extends SGraphScene {
         if (this.focusItem) {
             const old = this.focusItem.text;
             this.focusItem.text = str;
-            this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", old, str));
+            // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", old, str));
         }
     }
 
@@ -202,7 +202,7 @@ export class EditScence extends SGraphScene {
             let font = new SFont(this.focusItem.font);
             font.size = size;
             this.focusItem.font = font;
-            this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "font", old, font));
+            // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "font", old, font));
 
         }
     }
@@ -229,9 +229,35 @@ export class EditScence extends SGraphScene {
         if (this.focusItem.color) {
             let old = this.focusItem.color;
             this.focusItem.color = color;
-            this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
+            // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
+        }
+    }
+
+    /**
+     * 更改item宽
+     * @param width number 颜色
+     */
+
+    updatedWidth(width: number): void {
+        if (this.focusItem) {
+            // let old = this.focusItem.width;
+            this.focusItem.width = width;
+            // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
         }
     }
+     /**
+     * 更改item高
+     * @param height number 颜色
+     */
+
+    updatedHeight(height: number): void {
+        if (this.focusItem) {
+            // let old = this.focusItem.width;
+            this.focusItem.height = height;
+            // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
+        }
+    }
+
 
     /**
      * 删除指定item

+ 13 - 5
vue.config.js

@@ -7,12 +7,20 @@ module.exports = {
         },
         proxy: {
             "/wanda": {
-                    target: "http://map.wanda.cn/editor/fmap/1001724_29",
-                    changeOrigin: true,
-                    pathRewrite: {
-                        "^/wanda": ""
+                target: "http://map.wanda.cn/editor/fmap/1001724_29",
+                changeOrigin: true,
+                pathRewrite: {
+                    "^/wanda": ""
                 }
-            }
+            },
+            "/serve": {
+                target: "http://192.168.200.87:8088",
+                changeOrigin: true,
+                secure: false,
+                pathRewrite: {
+                    "^/serve": "",
+                },
+            },
         }
     },
     chainWebpack: (config) => {