javascript - Multiple drag functions on d3 force drag layout -
javascript - Multiple drag functions on d3 force drag layout -
i have next layout:
gray side: main container (zoom, pan) white circles: d3 nodes (mousedown
, mouseup
, drag
) red rectangles: rectangles (drag
, without container panning) when dragging reddish rectangles, don't want drag main container too.
also, when zooming, should'n affected.
i think issue related to:
// add together rectangle pan handlers containerparent.append("rect") .attr("width", svgwidth) .attr("height", svgheight) .style("fill", "none") .style("pointer-events", "all");
jsfiddle
by moving code snippet post before appending g
element containing starter elements, issue fixed:
... // add together rectangle pan handlers containerparent.append("rect") .attr("width", svgwidth) .attr("height", svgheight) .style("fill", "none") .style("pointer-events", "all"); // add together starter elements , container var starterelmsparent = containerparent.append("g"); ...
fiddle: http://jsfiddle.net/praveenscience/88gl4aks/ javascript jquery css d3.js
Comments
Post a Comment