fix
This commit is contained in:
@@ -139,11 +139,10 @@
|
||||
// if (!subordNode) {
|
||||
taskList.forEach((item,index) => {
|
||||
nodeManager.createResultNode({
|
||||
positionY: (index + subordNodes.length) * (50 + 250),
|
||||
data: {
|
||||
superiorID: attrs.node.id,
|
||||
superiorNodeType: attrs.node?.data?.type,
|
||||
createIndexPosition: index,
|
||||
createIndexPosition: index + subordNodes.length,
|
||||
tier: currentComponent.value.tier,
|
||||
isActive: index == 0 && subordNodes.length == 0,
|
||||
data: {
|
||||
|
||||
@@ -46,16 +46,28 @@ export class NodeManager {
|
||||
createNode(options: NodeOptions) {
|
||||
const superiorID = options?.data?.superiorID
|
||||
const snode = superiorID ? this.stateManager.flowManager.getNodeById(superiorID) : this.stateManager.flowManager.getLastNode();
|
||||
//获取上级节点所生成的最后一个node,设置位置为最后一个节点的xy 加上 节点间距
|
||||
const superiorGenerateNodes = this.stateManager.getSubordNodes(superiorID)
|
||||
const endGenerateNode = superiorGenerateNodes.reduce((max, current) => {
|
||||
return current.data.createIndexPosition > max.data.createIndexPosition ? current : max
|
||||
}, superiorGenerateNodes[0])
|
||||
const id = options.id || createId()
|
||||
const positionX = options.positionX || 0
|
||||
const positionY = options.positionY || 0
|
||||
const position = options.position ||
|
||||
(!snode ?
|
||||
(
|
||||
endGenerateNode?
|
||||
{
|
||||
x: endGenerateNode.position.x + positionX,
|
||||
y: endGenerateNode.position.y + positionY + this.ranksep + 200
|
||||
} :
|
||||
!snode ?
|
||||
{ x: positionX, y: positionY } :
|
||||
{
|
||||
x: snode.position.x + snode.dimensions.width + this.nodesep + positionX,
|
||||
y: snode.position.y + positionY
|
||||
})
|
||||
}
|
||||
)
|
||||
const data = options?.data || {}
|
||||
data['component'] = options.component
|
||||
const options_ = {
|
||||
|
||||
Reference in New Issue
Block a user