I want that like in the image, if i programatically add a new node between two nodes (3 and 4 in this case), the new node should take the location of the node 4 and all the nodes after 4 should move its location maybe 300points to the right.
in the example, there are very few nodes after 4, but there could be 100s of nodes after that some with multiple child nodes. how to ensure all these nodes shift 300points to the right. also, i dont want nodes to overlap.
There are a lot of choices that you could reasonably make for this situation.
I think you want in a transaction to call Diagram.moveParts to actually shift some nodes towards the right. But which collection? Did you want to find all nodes that are connected (perhaps indirectly) via links with the newly placed Node that are also to the right of that Node? Or just all nodes that are on the right side of the node, even if they are not connected with the new Node? I guess it also depends on whether or not there are unrelated (i.e. not connected with the new node) nodes that might be occupying space farther towards the right side (beyond your screenshot) where you would naturally want to shift nodes into.
the idea is i want to add the new node at the location of node 4 since i added it between 3 and 4, and shift 4 and all its children to the right without changing the structure of the existing nodes. i hope ur getting what i mean.
You’ll need to figure out which nodes you want to move. I can imagine a number of reasonable policy choices. But you’ll need to consider all of the possible graphs that you might be inserting into.
I didn’t understand this. when you say a number of reasonable policy choices, could please you give me some examples so I could explain this better.
at the top of mind, i feel, doing something like identifying node 4 and all its children and sub-children (maybe NOT the nodes that go into 4) and shifting those nodes should possibly do the trick.
There isn’t any built-in behavior implementing what I am guessing you might want. You will need to find that collection of Nodes (and Links) yourself.
I am guessing that you want to include Nodes that are to the right of dependent/successor nodes that are also overlapping the area where the nodes will be moved.