[英]AlloyUI: react to node - click event in Diagram Builder
i want to react in a different way to the event when a user clicks on a node in the diagram builder. 当用户单击图构建器中的节点时,我想以不同的方式对事件做出反应。
I know how to create custom nodes (I found the discussion here on stackoverflow) but I do not know how to overwrite the code that gets called when a user clicks the node. 我知道如何创建自定义节点(我在此处找到关于stackoverflow的讨论),但是我不知道如何覆盖用户单击节点时调用的代码。
I tried it with extending the "custom node" example : 我尝试通过扩展“自定义节点”示例进行尝试:
Y.DiagramNodeCustom = Y.Component.create({
NAME: 'diagram-node',
ATTRS: {
type: {
value: 'custom'
},
},
on: {
render: function(event) { alert('render node');
},
click: function(event) { alert('click node');
},
select: function(event) { alert('select node');
}
},
EXTENDS: Y.DiagramNodeTask
});
... but no luck ...但是没有运气
Who can tell me how I can replace the click event listener ? 谁能告诉我如何替换点击事件监听器?
you can change the function on the library 您可以在库上更改功能
_onNodeClick: function(event) {
var instance = this;
//get the object
var diagramNode = A.Widget.getByNode(event.currentTarget);
//mark as selected
instance.select(diagramNode);
//open edit pannel
instance._onNodeEdit(event);
event.stopPropagation();
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.