My project involves links that are connected via ports.
The user can place the ports any where around the node using the PortShitingTool.
Sometimes the user is moving nodes, so i wants that its connected links to change their spot (as well as the ports) and to have the shortest path between the nodes link, like you present in the LinkshiftingTool sample.
As result, it avoids links crossing nodes or links that are connected to port on the wrong side.
I understand that i can use the LinkshiftingTool, but will it work with ports ? will it move the ports to the desired place ?
The LinkShiftingTool only modifies the Link. But it seems you are talking about the DraggingTool.
If you really want ports to move automatically based on connected link routing as nodes move, it sounds as if you really should not be using ports at all. But if that is not generally the case, perhaps you want to customize the DraggingTool to modify the positions of the ports on each node?
So i will have to implement it myself.
You could override DraggingTool.doMouseMove.
Call the super method first. Then if
this.isActive() is true, you can look at DraggingTool.draggedParts to see the collection of nodes and links that are being moved. The collection is actually a Map whose keys are the Parts that are moving.
I did almost the same.
I implemented a handler for “SelectionMoved”.