dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.85k stars 587 forks source link

issue on removing Cluster node #357

Open paweljabl opened 5 years ago

paweljabl commented 5 years ago

Hi,

hope I don't abuse the issue log - but I have a problem with removing the cluster node. Not sure if this is bug, or I'm doing something wrong ? Please find the code below to reproduce the issue:

If y take the cluster demo example: https://dagrejs.github.io/project/dagre-d3/latest/demo/clusters.html

and add the following snippet: d3.selectAll("g.node,g.cluster").on('click', function (v) { let existing_child_nodes = g.children(v); //console.log(existing_child_nodes); if (existing_child_nodes.length != 0) { existing_child_nodes.forEach(function (d) {g.removeNode(d) }); } g.removeNode(v); svgGroup = svg.append("g"); render(d3.select("svg g"), g); var xCenterOffset = (svg.attr("width") - g.graph().width) / 2; svgGroup.attr("transform", "translate(" + xCenterOffset + ", 20)"); svg.attr("height", g.graph().height + 40); });

you get an error once clicking on the cluster. Could you please advise ?

thanks, Pawel