This demonstrates the ability to simulate having nodes be members of multiple "groups". Regular Groups only support a single Part.containingGroup for nodes. This sample does not make use of Groups at all, but simulates one possible "grouping" relationship using a custom Layout and a custom DraggingTool.

The CustomLayout assumes regular nodes already have real locations, and only assigns Part.location to "Super" nodes. It also sets the GraphObject.desiredSize on the "BODY" element of each "Super" node, based on the area occupied by all of its member nodes. The CustomDraggingTool overrides the DraggingTool.computeEffectiveCollection method to determine what nodes to drag around.

This sample does not support dynamic restructuring of the relationships in the graph.

Diagram Model saved in JSON format:
加入 GoJS 交流群
GoJS 交流群 (769862113)