/* Invoke the tip in the context of your visualization */
.call(tooltip)
.select('g')
.attr('transform',
'translate('+margin.left+','+margin.right+')');
// define the baseSvg, attaching a class for styling and the zoomListener
varbaseSvg=element.append('svg')
.attr("width",viewerWidth)
.attr("height",viewerHeight)
.attr("class","overlay")
.call(zoomListener)
.call(tooltip);
// Define the drag listeners for drag/drop behaviour of nodes.
dragListener=d3.behavior.drag()
.on("dragstart",function(d){
if(d===root){
return;
}
dragStarted=true;
nodes=tree.nodes(d);
d3.event.sourceEvent.stopPropagation();
// it's important that we suppress the mouseover event on the node being dragged. Otherwise it will absorb the mouseover event and the underlying node will not detect it d3.select(this).attr('pointer-events', 'none');
})
.on("dragend",function(d){
if(d===root){
return;
}
domNode=this;
if(selectedNode){
// now remove the element from the parent, and insert it into the new elements children