1

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;
                    }
                });
Nirmala
  • 43
  • 1
  • 10
  • setTimeout() could be useful, also why is dragend getting called when you first click ? :/ you calling it in the wrong place ? – AJ_91 Apr 23 '15 at 14:06
  • One doubt, is dragend() gets fire on second click event? Can you tell me , what is correct place to call dragend() and click()? – Nirmala Apr 24 '15 at 07:35

0 Answers0