fix
This commit is contained in:
@@ -139,11 +139,10 @@
|
|||||||
// if (!subordNode) {
|
// if (!subordNode) {
|
||||||
taskList.forEach((item,index) => {
|
taskList.forEach((item,index) => {
|
||||||
nodeManager.createResultNode({
|
nodeManager.createResultNode({
|
||||||
positionY: (index + subordNodes.length) * (50 + 250),
|
|
||||||
data: {
|
data: {
|
||||||
superiorID: attrs.node.id,
|
superiorID: attrs.node.id,
|
||||||
superiorNodeType: attrs.node?.data?.type,
|
superiorNodeType: attrs.node?.data?.type,
|
||||||
createIndexPosition: index,
|
createIndexPosition: index + subordNodes.length,
|
||||||
tier: currentComponent.value.tier,
|
tier: currentComponent.value.tier,
|
||||||
isActive: index == 0 && subordNodes.length == 0,
|
isActive: index == 0 && subordNodes.length == 0,
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -46,16 +46,28 @@ export class NodeManager {
|
|||||||
createNode(options: NodeOptions) {
|
createNode(options: NodeOptions) {
|
||||||
const superiorID = options?.data?.superiorID
|
const superiorID = options?.data?.superiorID
|
||||||
const snode = superiorID ? this.stateManager.flowManager.getNodeById(superiorID) : this.stateManager.flowManager.getLastNode();
|
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 id = options.id || createId()
|
||||||
const positionX = options.positionX || 0
|
const positionX = options.positionX || 0
|
||||||
const positionY = options.positionY || 0
|
const positionY = options.positionY || 0
|
||||||
const position = options.position ||
|
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: positionX, y: positionY } :
|
||||||
{
|
{
|
||||||
x: snode.position.x + snode.dimensions.width + this.nodesep + positionX,
|
x: snode.position.x + snode.dimensions.width + this.nodesep + positionX,
|
||||||
y: snode.position.y + positionY
|
y: snode.position.y + positionY
|
||||||
})
|
}
|
||||||
|
)
|
||||||
const data = options?.data || {}
|
const data = options?.data || {}
|
||||||
data['component'] = options.component
|
data['component'] = options.component
|
||||||
const options_ = {
|
const options_ = {
|
||||||
|
|||||||
Reference in New Issue
Block a user