增加工具栏提示。
This commit is contained in:
parent
fab609fdbb
commit
18725c5ef7
@ -235,43 +235,45 @@ const WorkflowDesign: React.FC = () => {
|
||||
const node = JSON.parse(nodeData);
|
||||
const { clientX, clientY } = e;
|
||||
const point = graph.clientToLocal({ x: clientX, y: clientY });
|
||||
|
||||
console.log('Node Config:', node);
|
||||
console.log('Ports Config:', node.graphConfig.uiSchema.ports);
|
||||
console.log('Converted Ports:', convertPortConfig(node.graphConfig.uiSchema.ports));
|
||||
const nodeConfig = {
|
||||
shape: node.graphConfig.uiSchema.shape,
|
||||
inherit: node.graphConfig.uiSchema.shape === 'circle' ? 'circle' :
|
||||
node.graphConfig.uiSchema.shape === 'polygon' ? 'polygon' :
|
||||
node.graphConfig.uiSchema.shape === 'diamond' ? 'polygon' : 'rect',
|
||||
width: node.graphConfig.uiSchema.size.width,
|
||||
height: node.graphConfig.uiSchema.size.height,
|
||||
attrs: {
|
||||
body: {
|
||||
fill: node.graphConfig.uiSchema.style.fill,
|
||||
stroke: node.graphConfig.uiSchema.style.stroke,
|
||||
strokeWidth: node.graphConfig.uiSchema.style.strokeWidth,
|
||||
...node.graphConfig.uiSchema.style,
|
||||
// 如果是菱形,添加 refPoints
|
||||
...(node.graphConfig.uiSchema.shape === 'diamond' ? {
|
||||
refPoints: '50,0 100,50 50,100 0,50'
|
||||
} : {})
|
||||
},
|
||||
label: {
|
||||
text: node.name,
|
||||
fill: '#000000',
|
||||
fontSize: 12,
|
||||
}
|
||||
},
|
||||
},
|
||||
ports: {
|
||||
groups: generatePortGroups(),
|
||||
items: generatePortItems(),
|
||||
},
|
||||
// ports: convertPortConfig(node.graphConfig.uiSchema.ports)
|
||||
};
|
||||
// 注册节点类型
|
||||
Graph.registerNode(node.code, nodeConfig, true);
|
||||
|
||||
// 创建节点时设置完整的属性
|
||||
graph.addNode({
|
||||
...nodeConfig,
|
||||
shape: node.graphConfig.uiSchema.shape,
|
||||
x: point.x,
|
||||
y: point.y,
|
||||
// 保存完整的节点信息
|
||||
type: node.type,
|
||||
code: node.code,
|
||||
graph: {
|
||||
shape: node.graphConfig.uiSchema.shape,
|
||||
size: node.graphConfig.uiSchema.size,
|
||||
style: node.graphConfig.uiSchema.style,
|
||||
ports: node.graphConfig.uiSchema.ports
|
||||
},
|
||||
// ports: nodeConfig.ports,
|
||||
ports: convertPortConfig(node.graphConfig.uiSchema.ports),
|
||||
// 保存节点定义,用于后续编辑
|
||||
nodeDefinition: node,
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user