I am using D3.js , Whenever I click on d3 tree node the drag end event gets fired. How to execute the click and drag end event separately. I believe that there is huge difference between drag end and click function.
var nodeEnter = node.enter().append("g").call(dragListener).attr(
"class", "node").attr("transform", function(d) {
return "translate(" + source.y0 + "," + source.x0 + ")";
}).on("mouseenter", function(d){
node_Mouse_Enter(d);
}).on("mouseleave", function(d){
node_Mouse_Leave(d);
}).on('click', function(d){
if (d3.event.defaultPrevented) return;
d3.event.stopImmediatePropagation();
click(d);
}).attr('id', function(d) {
return d.nodeId;
});
here is endDrag function:
d3.behavior
.drag()
.on("dragend",
function(d) {
tip.hide(d);
if (d == root) {
return;
}
else {
return;
}
});