|
@@ -167,14 +167,45 @@ Graph.registerConnector(
|
|
|
true
|
|
|
);
|
|
|
|
|
|
+// 组织结构
|
|
|
+Graph.registerConnector(
|
|
|
+ "organization-branch-connector",
|
|
|
+ function (sourcePoint, targetPoint, routerPoints, options) {
|
|
|
+ const pathData = `
|
|
|
+ M ${sourcePoint.x} ${sourcePoint.y}
|
|
|
+ L ${sourcePoint.x} ${sourcePoint.y + 10}
|
|
|
+ L ${targetPoint.x} ${sourcePoint.y + 10}
|
|
|
+ L ${targetPoint.x} ${targetPoint.y}
|
|
|
+ `;
|
|
|
+ return options.raw ? Path.parse(pathData) : pathData;
|
|
|
+ },
|
|
|
+ true
|
|
|
+);
|
|
|
+Graph.registerConnector(
|
|
|
+ "organization-sub-connector",
|
|
|
+ function (sourcePoint, targetPoint, routerPoints, options) {
|
|
|
+ const pathData = `
|
|
|
+ M ${sourcePoint.x} ${sourcePoint.y}
|
|
|
+ L ${sourcePoint.x} ${sourcePoint.y + 10}
|
|
|
+ L ${targetPoint.x} ${sourcePoint.y + 10}
|
|
|
+ L ${targetPoint.x} ${targetPoint.y}
|
|
|
+ `;
|
|
|
+ return options.raw ? Path.parse(pathData) : pathData;
|
|
|
+ },
|
|
|
+ true
|
|
|
+);
|
|
|
+
|
|
|
const getConnector = (
|
|
|
structure: StructureType,
|
|
|
theme: string,
|
|
|
type: TopicType
|
|
|
) => {
|
|
|
// TODO根据结构处理连接线
|
|
|
- if(structure === StructureType.tree) {
|
|
|
- return `tree-${type}-connector`
|
|
|
+ if (structure === StructureType.tree) {
|
|
|
+ return `tree-${type}-connector`;
|
|
|
+ }
|
|
|
+ if (structure === StructureType.organization) {
|
|
|
+ return `organization-${type}-connector`;
|
|
|
}
|
|
|
const themeObj = getTheme(theme);
|
|
|
if (type === TopicType.branch) {
|
|
@@ -211,8 +242,8 @@ const getSourceAnchor = (type: TopicType, structure: StructureType) => {
|
|
|
? {
|
|
|
name: "bottom",
|
|
|
args: {
|
|
|
- dy: -5
|
|
|
- }
|
|
|
+ dy: -5,
|
|
|
+ },
|
|
|
}
|
|
|
: {
|
|
|
name: "bottomLeft",
|
|
@@ -221,10 +252,14 @@ const getSourceAnchor = (type: TopicType, structure: StructureType) => {
|
|
|
},
|
|
|
};
|
|
|
}
|
|
|
+ case StructureType.organization: {
|
|
|
+ return {
|
|
|
+ name: "bottom",
|
|
|
+ };
|
|
|
+ }
|
|
|
case StructureType.leftBracket:
|
|
|
case StructureType.leftFishbone:
|
|
|
case StructureType.leftTreeShape:
|
|
|
- case StructureType.organization:
|
|
|
case StructureType.rightBracket:
|
|
|
case StructureType.rightFishbone:
|
|
|
case StructureType.rightTreeShape:
|
|
@@ -258,10 +293,14 @@ const getTargetAnchor = (type: TopicType, structure: StructureType) => {
|
|
|
name: "left",
|
|
|
};
|
|
|
}
|
|
|
+ case StructureType.organization: {
|
|
|
+ return {
|
|
|
+ name: "top",
|
|
|
+ };
|
|
|
+ }
|
|
|
case StructureType.leftBracket:
|
|
|
case StructureType.leftFishbone:
|
|
|
case StructureType.leftTreeShape:
|
|
|
- case StructureType.organization:
|
|
|
case StructureType.rightBracket:
|
|
|
case StructureType.rightFishbone:
|
|
|
case StructureType.rightTreeShape:
|