Browse Source

锚点吸附

haojianlong 3 years ago
parent
commit
329cf1081a

+ 3 - 3
package.json

@@ -16,11 +16,11 @@
   },
   "dependencies": {
     "@persagy-web/base": "2.2.1",
-    "@persagy-web/big": "2.2.54",
+    "@persagy-web/big": "2.2.55",
     "@persagy-web/draw": "2.2.14",
     "@persagy-web/graph": "2.2.46",
-    "@persagy-web/big-edit": "2.2.27",
-    "@persagy-web/edit": "2.2.25",
+    "@persagy-web/big-edit": "2.2.29",
+    "@persagy-web/edit": "2.2.26",
     "@types/uuid": "^8.0.0",
     "ant-design-vue": "^1.6.5",
     "axios": "^0.20.0",

+ 4 - 4
src/components/editClass/persagy-edit/PTopoScene.ts

@@ -111,10 +111,10 @@ export class PTopoScene extends SBaseEditScene {
     onMouseDown(event: SMouseEvent): any {
         this.vueOnMouseDown(event) //外部调用
         if (this.grabItem) {
-            // if (this.grabItem instanceof SBasePipe) {
-            //     this.setTipeEndanchor(event)
-            //     return true;
-            // }
+            if (this.grabItem instanceof SBasePipe) {
+                this.setTipeEndanchor(event)
+                return true;
+            }
             return this.grabItem.onMouseDown(event);
         }
         if (this.editCmd == "EditBaseLine") {

+ 26 - 26
src/components/editview/baseTopoEditer.vue

@@ -313,33 +313,33 @@ export default {
       parse.relations.forEach((t) => {
         // 设置锚点
         // (此处为吸附功能、需要要求注掉)
-        // if (t.anchor1Id) {
-        //   let startAnc = null;
-        //   anchorList.forEach((aItem) => {
-        //     if (aItem.id == t.anchor1Id) {
-        //       startAnc = aItem;
-        //     }
-        //   });
+        if (t.anchor1Id) {
+          let startAnc = null;
+          anchorList.forEach((aItem) => {
+            if (aItem.id == t.anchor1Id) {
+              startAnc = aItem;
+            }
+          });
 
-        //   if (startAnc) {
-        //     startAnc.isConnected = true;
-        //     startAnc.parent?.connect("changePos", t, t.changePos);
-        //     t.startAnchor = startAnc || null;
-        //   }
-        // }
-        // if (t.anchor2Id) {
-        //   let endAnc = null;
-        //   anchorList.forEach((aItem) => {
-        //     if (aItem.id == t.anchor2Id) {
-        //       endAnc = aItem;
-        //     }
-        //   });
-        //   if (endAnc) {
-        //     endAnc.isConnected = true;
-        //     endAnc.parent?.connect("changePos", t, t.changePos);
-        //     t.endAnchor = endAnc || null;
-        //   }
-        // }
+          if (startAnc) {
+            startAnc.isConnected = true;
+            startAnc.parent?.connect("changePos", t, t.changePos);
+            t.startAnchor = startAnc || null;
+          }
+        }
+        if (t.anchor2Id) {
+          let endAnc = null;
+          anchorList.forEach((aItem) => {
+            if (aItem.id == t.anchor2Id) {
+              endAnc = aItem;
+            }
+          });
+          if (endAnc) {
+            endAnc.isConnected = true;
+            endAnc.parent?.connect("changePos", t, t.changePos);
+            t.endAnchor = endAnc || null;
+          }
+        }
         t.connect("finishCreated", this.scene, this.scene.finishCreated);
         t.connect("onContextMenu", this, this.scene.getItem);
         this.scene.addItem(t);

+ 9 - 0
src/components/editview/equipAnchor.js

@@ -28,5 +28,14 @@ export const equipAnchor = {
         y: -50
       }
     },
+  ],
+  "WSDWWT": [ // 生活给水储水箱
+    {
+      id: '',
+      pos: {
+        x: 12,
+        y: -10
+      }
+    },
   ]
 }