|
@@ -42,6 +42,7 @@ import {
|
|
|
} from "@/api/editer";
|
|
|
import { publishGraph } from "@/api/home";
|
|
|
import crypto from "crypto-js/";
|
|
|
+import { equipAnchor } from "./equipAnchor";
|
|
|
//////////////////////////////////////
|
|
|
// 常量
|
|
|
// 图服务路径
|
|
@@ -348,36 +349,34 @@ export default {
|
|
|
});
|
|
|
parse.relations.forEach((t) => {
|
|
|
// 设置锚点
|
|
|
- if (this.scene.isAdsorb) {
|
|
|
- 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.anchor1Id && this.scene.isAdsorb) {
|
|
|
+ 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 (t.anchor2Id && this.scene.isAdsorb) {
|
|
|
+ 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);
|
|
@@ -550,6 +549,9 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
+ if (equipAnchor[item.classCode]) {
|
|
|
+ data.anchorList = equipAnchor[item.classCode];
|
|
|
+ }
|
|
|
parse.addNode(data);
|
|
|
});
|
|
|
// 添加到 scence 中
|