Skip to content Skip to sidebar Skip to footer

D3js Zoom + Drag Causes Conflict

I am trying to apply the zoom behaviour to a svg where certain elements in the svg are already bound with drag behaviour. without the zoom behaviour drag works fine, without the dr

Solution 1:

I have implemented individual dragging of nodes working along with overall zooming and panning functionality. Used stopPropagation of the event in dragstart event of circles.

Hope this helps.

var move = d3.behavior.drag()
    .on("dragstart", function() {
        d3.event.sourceEvent.stopPropagation();
    });

Working JSFiddle

Post a Comment for "D3js Zoom + Drag Causes Conflict"