All examples By author By category About

emeeks

Bounding Box Collision

A simple first stab at building a bounding-box style collision detection rule for d3V4 forceSimulation. Bounding box is a rule that produces a top-left and bottom right corner with coordinates local to the center of the node. So, in this case the size of the bounding box is fixed at a height of 20px offset by 10px and a variable width based on the length of the label of the node.

Source code here