D3 Mouse Events — Click & DragEnd

前端 未结 2 1823
独厮守ぢ
独厮守ぢ 2020-12-02 21:16

In D3, if you defined a drag function like this:

var drag = d3.behavior.drag()
        .on(\"drag\", function () {alert(\"drag\")})
        .on(\"dragend\",          


        
2条回答
  •  臣服心动
    2020-12-02 21:41

    Since 4.9.0 there is .clickDistance() with which you can control after which distance moved (from where you started dragging) you won't get a click event.

    Note that you might get any click event at all if you remove the element from the DOM before release of the button (e.g. by using .raise() in the drag handler).

提交回复
热议问题