节点左击
graph.on('node:click', function(evt) {
//获取当前节点数据信息
var CellId = evt.item._cfg.id;
var ChildId = evt.item._cfg.model.cellid;
var NodeState = evt.item._cfg.model.state;
});
节点右击
graph.on('node:contextmenu', function(evt) {
//当前节点定位
var top=evt.clientY;
var left=evt.clientX;
var a=$("#mountNode").height()-$(".tools-box").height();
var width1=$("#mountNode").width();
var width2=$(".tools-box").width();
var b=$("#mountNode").width()-$(".tools-box").width();
//当前节点数据信息
rightNode = evt.item._cfg.id;
rightNodeParent = evt.item._cfg.model.parentid;
rightNodestate = evt.item._cfg.model.state;
rightNodelabel = evt.item._cfg.model.label;
rightCurrentHumId = evt.item._cfg.model.CurrentHumId;
rightFromHumId = evt.item._cfg.model.FromHumId;
});
实例链接
https://blog.csdn.net/weixin_41825921/article/details/103921304
或
https://blog.csdn.net/weixin_41825921/article/details/103919054