JointJS - 处理链接删除点击

Joe*_*aus 3 javascript jointjs

创建链接后,将鼠标悬停在其上会显示红色(X)以将其删除.

单击此按钮将触发一系列事件(通过订阅"all"事件收集):

  • 电池:pointerdown
  • 链接:pointerdown
  • cell:pointermove(x5,似乎可疑)
  • 电池:pointerup

在浏览文档并花费太长时间深入研究这些事件的参数对象后,我发现没有什么可以用来有效地知道链接是否即将被删除.

当然我错过了一些明显的东西?

我可以比较指针向下和指针之间的图形链接集合,但这非常难看.

dav*_*ave 10

您可以侦听图形remove事件以查看链接是否已删除:

graph.on('remove', function(cell, collection, opt) {
   if (cell.isLink()) {
      // a link was removed  (cell.id contains the ID of the removed link)
   }
})
Run Code Online (Sandbox Code Playgroud)