UPDATE: VERSION-20260316
This commit is contained in:
@@ -44,6 +44,33 @@ export const createGraphTaskElementFromScenario = (
|
||||
} as GraphTaskElement;
|
||||
};
|
||||
|
||||
const portsGroups = {
|
||||
in: {
|
||||
position: 'left', // 入桩在左侧
|
||||
attrs: {
|
||||
circle: {
|
||||
r: 6,
|
||||
magnet: 'passive', // 被动吸附(仅作为连线目标)
|
||||
stroke: '#5da1df',
|
||||
strokeWidth: 2,
|
||||
fill: '#fff',
|
||||
},
|
||||
},
|
||||
},
|
||||
out: {
|
||||
position: 'right', // 出桩在右侧
|
||||
attrs: {
|
||||
circle: {
|
||||
r: 6,
|
||||
magnet: 'active', // 主动吸附(作为连线源)
|
||||
stroke: '#5da1df',
|
||||
strokeWidth: 2,
|
||||
fill: '#5da1df',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const createGraphScenarioElement = (element: GraphTaskElement): any => {
|
||||
let realHeight = 120;
|
||||
let width: number = 250;
|
||||
@@ -58,6 +85,24 @@ export const createGraphScenarioElement = (element: GraphTaskElement): any => {
|
||||
}
|
||||
}
|
||||
|
||||
// const portsItems = (element.components || []).map((comp, index) => {
|
||||
// const compId = comp.id || index;
|
||||
// return [
|
||||
// // 入桩(对应 DOM: data-port="in-${compId}")
|
||||
// {
|
||||
// id: `in-${compId}`, // portId 必须和 DOM 的 data-port 一致
|
||||
// group: 'in',
|
||||
// data: comp, // 直接存储 port 数据,避免后续解析 DOM
|
||||
// },
|
||||
// // 出桩(对应 DOM: data-port="out-${compId}")
|
||||
// {
|
||||
// id: `out-${compId}`,
|
||||
// group: 'out',
|
||||
// data: comp,
|
||||
// },
|
||||
// ];
|
||||
// }).flat(); // 扁平化数组
|
||||
|
||||
return {
|
||||
shape: 'scenario',
|
||||
id: element.key,
|
||||
@@ -75,5 +120,9 @@ export const createGraphScenarioElement = (element: GraphTaskElement): any => {
|
||||
},
|
||||
},
|
||||
data: element,
|
||||
// ports: {
|
||||
// groups: portsGroups,
|
||||
// items: portsItems,
|
||||
// },
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user