/* Invoke the tip in the context of your visualization */
.call(tooltip)
.select('g')
.attr('transform',
'translate('+margin.left+','+margin.right+')');
//arrow
svg.append("svg:defs").append("svg:marker").attr("id","arrow").attr("viewBox","0 0 10 10").attr("refX",26).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",6).attr("markerHeight",9).attr("orient","auto").append("svg:path").attr("d","M 0 0 L 10 5 L 0 10 z");
// 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