jointJS - 为什么pointerclick事件不起作用,只引发指针

pau*_*l_n 7 jointjs

这有效:

paper.on('cell:pointerdown', function(cellView, evt, x, y) {
   alert("pointerdown");
}); 
Run Code Online (Sandbox Code Playgroud)

但是这段代码没有:

paper.on('cell:pointerclick', function(cellView, evt, x, y) {
   alert("pointerclick");
}); 
Run Code Online (Sandbox Code Playgroud)

这样做的原因是指针下降始终是第一个触发,我如何使用pointerclick而不是遇到指针?

编辑:这个问题可能有点误导:我想知道为什么当我点击鼠标指针时没有触发指针点击.ponterdown正在工作,但它停在那里,没有任何进一步传播(例如,当我按下鼠标按钮时...-因此执行点击)

pau*_*l_n 11

好的,我找到了解决方案.在joint.js中有一个开关:

        // Allowed number of mousemove events after which the pointerclick event will be still triggered.
        clickThreshold: 0,
Run Code Online (Sandbox Code Playgroud)

所以,如果我像这样设置我的论文:

var paper = new joint.dia.Paper({
    //... other settings
    clickThreshold: 1  //or any number > 0 if you have more specific events there
})
Run Code Online (Sandbox Code Playgroud)

有用!关于JointJS的文档中没有关于clickThreshold的内容,我想可能值得添加它,尤其是与pointerclick等事件相结合.