|| | |||Browse by category|
What is the difference between the methods performLayoutOnce and setNodeLayout?
Both these methods are used to perform layout to a network. However, they work differently.
- The method
setNodeLayoutsets a permanent layout to the network. That means that the layout will be performed each time you move a node in your grapher.
- If you use the method
performLayoutOnce, the layout will be performed when you call the method, and will not be performed again until you call
This is why you can get the following behaviors:
- You have set a layout but when you try to move a node, its position does not change.You probably called
setNodeLayout. If you move a node, the layout will be performed right away and the node will be positioned as it was before. It seems that the node position has not changed. In fact, it has changed and the node has been moved back by the layout.
- You have added a node in the network and the layout does not consider this new node.You probably called
performLayoutOnce. The changes in the network will not be taken into account by the layout. If you want the new node to be layed out, you should use
If you want to call the layout only when needed, you can add a button (or a key-pressed command) which activates the layout and uses the method