Forked from https://gist.github.com/pkerpedjiev/0389e39fad95e1cf29ce
This is an extension of Mike Bostock's Draggable Network II example, allowing one to drag multiple nodes in a force-directed graph. Nodes can be selected by holding the shift key and either dragging on the canvas or clicking on specific nodes. The selection and dragging semantics aim to mirror those of most window managers:
- Shift clicking on a node toggles whether it is selected
- Clicking (without shift) on a node, selects it and deselects everything else.
- Shift dragging on the canvas toggles the selection status of the nodes enclosed within it.
- Dragging a set of selected nodes drags all of them.
- Clicking on the canvas de-selects everything.