jointjs - 不触发单元格事件

标签 jointjs

我有一份带有图表的工作文件。我已向图表中添加了多个单元格,并且正在尝试监听 cell:highlight 事件,但我从未收到它。

我正在做:

paper.on('cell:highlight', function() { ... });

其他事件似乎工作正常,例如:blank:pointerup,...

是否需要采取一些特殊措施才能使细胞事件发挥作用?

最佳答案

根据文档:

cell:highlight - triggered when highlight() method is called on either an element or a link. Note that this method is also called automatically when the user is reconnecting a link and the connection is valid (validateConnection() returns true) or if embeddingMode is enabled on the paper and the dragging element is above another element it could be dropped into (validateEmbedding() returns true). The handler for this event has the following signature: function(cellView,el). The handler defaults to function(cellView, el) { V(el).addClass('highlighted') }. In other words, the 'higlighted' CSS class is added and so you can style the highlighted element in CSS. If you want to use a different method for highlighting cells, call paper.off('cell:highlight') first to unregister the default handler and then paper.on('cell:highlight', myHandler) to register your own.

您可以阅读更多相关信息here .

关于jointjs - 不触发单元格事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34904621/

相关文章:

javascript - 如何 "copy/paste"子图——JointJS

javascript - JointJS库中元素Shapes的fsa.State方法是什么

javascript - 如何给JointJS元素一个删除工具?

javascript - 如何更改 JointJS 中自定义对象的属性?

javascript - 使用jointjs在圆圈中绘制标记

node.js - 解释或演示 JointJS 和 Node.js 之间的集成

html - 如何禁用 'remove' 对 jointjs 链接的操作?

javascript - JointJS 中的自动换行

javascript - 整合angular和joint js

webpack - 如何将 jointjs 与 Vue 2 和 webpack 集成