I think that you basically have a collision / intersection detection problem. And, as mentioned in the links posted above, there seems to be incorrect browser support for a reliable way to do this in SVG or D3.
However, in your tree example, the way (Technique 1 of this answer ) to get around this is to draw large transparent circles around the same x, y coordinates as the nodes. You can then detect the mouse cursor events on them and draw a temporary connector to show the user.
I have a working example of this here: http://bl.ocks.org/explunit/5603250
The key section is to draw a larger, transparent node, and then detect mouseover events on it:
node.append("circle") .attr("r", 60) .attr("opacity", 0.0) // change this to non-zero to see the target area .on("mouseover", overCircle) .on("mouseout", outCircle)
The rest of the code is just the logic around dragging and tracking the source / target when everything moves.
I'm not sure if this is much better than Technique 2 from this answer , but your question made me curiously try this approach.
explunit
source share