Dragging nodes left to right that re-order diagram and shift child nodes

I am looking for guidance or an example where we can select and move a node left to right only and have the child nodes follow… I think of it almost like snapping… Once a node on the same level is dragged past another it will re-draw the diagram and all child nodes will follow…

It was hard explaining in text what I am trying to do so I posted a video:

See the first example in the documentation for DraggingTool: DraggingTool | GoJS API. Or see the documentation for Part | GoJS API and Part | GoJS API.

Also see DraggingTool | GoJS API, which you probably want to set to true.

However I still do not understand what you really want to do, if it isn’t just a matter of setting the above properties and letting the Diagram.layout automatically rearrange everything.

Thanks for reply Walter.

If we drag node from left to right . Right shifted node will be right side when we re-layout the diagram.
Node ordering should remain persisted after re-layout of diagram. In our current implmentation its not maintaining ordering/position after re-layout position. Its going to its original position.

Yes, the information that is used by the layout needs to change if you want the results to change. It sounds like you need to change the sort order for nodes when they are moved.

Take a look, for example, at Swim Lanes (vertical). Note how both Pools and Lanes (each implemented by a different Group template) can only be moved horizontally, and PoolLayout respects their initial positions via a customization of the GridLayout.comparer property.

TreeLayout also has a comparer and sorting properties that you could customize, if you are using that instead of GridLayout.