This example demonstrates applying d3-drag to a force-directed graph computed using d3-force. When the drag gesture starts, the targeted node is fixed to the pointer; it is released when the gesture ends. In addition, the simulation is temporarily “heated” during interaction by setting the target alpha to a non-zero value.
Compare to the SVG version.
Is there a reason you have to write this to a canvas element vs. svg? This is the only example I have come across where this was done. Just curious as to why.