d3 v4 - drag 'clickDistance' doesn't seem to have any effect

喜夏-厌秋 提交于 2020-02-04 05:38:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!