问题
I have a d3 element 'itemGroup' which has other elements within it. One of these is a text label that I'd like to subscribe to the click events of.
Additionally, I'd like the itemGroup to be draggable. Without the code below the click events fire as expected. With the below code I get the drag behaviour I want, but the click event on the child element of itemGroup no longer fires.
d3.selectAll(".itemGroup").call(d3.drag().clickDistance(4).on("start", started));
I thought that 'clickDistance' was meant to address this but setting any large or small value doesn't seem to have any effect. I expected a value of '4' to mean that the drag behaviour wouldn't kick in until 4 or more distance units have been travelled by the mouse (in the mousedown state), but I see the drag behaviour start immediately.
Tried with 4, 40, 4000.... nothing changes the behaviour. I'm on the latest and greatest version to date.
Any ideas?
来源:https://stackoverflow.com/questions/46562548/d3-v4-drag-clickdistance-doesnt-seem-to-have-any-effect