Another feature that people occasionally request is the ability for “pieces” to be “stuck together” without the use of links.
The StickyNode example in Demo1, along with the use of a custom dragging tool, StickyDraggingTool, provides one such implementation. StickyNodes can be "stuck" onto other StickyNodes, forming a tree-like hierarchy of relationships.
StickyNodes have particular points that need to line up for one node to stick to another one. In StickyNode and StickyDraggingTool these points are implemented by ports, but you could implement other mechanisms if you wanted to. StickyDraggingTool also highlights ports to provide interactive feedback about potential "sticks".
Here's a sequence of screen shots demonstrating this custom dragging tool operating on some StickyNodes.
We start off with three disconnected StickyNodes:
Then we drag StickyNode2 to position it just below StickyNode1. This screen shot was taken during the drag of StickyNode2:
StickyNode implements a ToolTip to show what it's stuck to, if anything, and which other nodes are stuck to it, if any.
Then we stick StickyNode3 onto the side of StickyNode2:
Note how StickyNode2 knows that StickyNode3 is stuck to it:
Dragging StickyNode2 automatically drags any nodes stuck to it, recursively. This also unsticks StickyNode2 from StickyNode1:
Although this example implements a one-way stickiness relationship, it is also possible to implement a two-way relationship between objects. This would let you implement something like jigsaw puzzle pieces, where moving any piece would automatically move all connected pieces. However, you would then might need some other mechanism for disconnecting two pieces.