How to prevent the drag if the user clicks the round in d3.js?
问题 I have group element it has circle and rect elements. User can drag the group element, so both rect and circle element will move. It is working fine. But I need to prevent the drag if the user clicks on the circle element. JS Fiddle const x = 100; var y = 100; var grid = d3.select("#svg-area"); var g = grid.append("g") .attr("transform", `translate(${x},${y})`) .call(d3.drag() .on("drag", function() { var x1 = d3.event.x - 30; var y1 = d3.event.y - 10; d3.select(this).attr("transform",