Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Moving nodes sequentially?

$
0
0

@neomib wrote:

I managed to achieve what I wanted…
I’m still having a problem with positioning…
My code:

this.diagram.addDiagramListener("InitialLayoutCompleted",(e)=>this.recalculateNodesPosition(nodesArray));

 recalculateNodesPositionAndProps = (nodesArray) => {
        this.diagram.nodes.each(node => {
            ... 
             const layout = node.data.display.layout;
                // Group position
                // TBD : set the position without timeout.
                if (layout.position) {
                    const position = layout.position(node.diagram, node);
                    setTimeout(() => {
                        node.move(new go.Point(position.x, position.y));
                    }, 1000);
                    
                }
            }
        });
    }

If I’m removing the timeout the groups are not positioned correctly!
Is there a way to know when one node finished moving to call the move function on the next node?
Or maybe the other way around, make a node move wait until the previous move is done?

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles