Following on from this question, I'm trying to drag nodes (containing groups of circles and text) as combined units without them first jumping to a new position when I click.
I've tried implementing the suggested technique into a radial tree layout (JSFIDDLE) but am hitting a wall. I suspect this is because the radial layout is using a different x,y system than the usual x,y system. I've been trying to work rotate
into var drag
but can't quite seem to crack it. Is that where I should be focusing? Thanks.
var drag = d3.behavior.drag()
.on("drag", function(d,i) {
d.x += d3.event.dx
d.y += d3.event.dy
d3.select(this)
.attr("transform", function(d,i){
return "translate(" + d.x + "," + d.y + ")"
})
});