I'm creating custom node and I would like to highlight on mouse enter. Unfortunately the mouseEnter
event doesn't fire. I also don't know how to render the node after mouseEnter
and mouseLeave
.
问问题
417 次
1 回答
1
您是否在自定义节点类型定义中编写了“包含”函数和“渲染”函数?如果没有,则不会触发 mouseEnter/onRightClick 之类的事件。
这是包含自定义节点类型方法的代码。
$jit.ForceDirected.Plot.NodeTypes.implement({
'icon1': {
'render': function(node, canvas){
var ctx = canvas.getCtx();
var img = new Image();
img.src='magnify.png';
var pos = node.pos.getc(true);
img.onload = function() {
ctx.drawImage(img, pos.x, pos.y);
};
},
'contains': function(node,pos){
var npos = node.pos.getc(true);
dim = node.getData('dim');
return this.nodeHelper.circle.contains(npos, pos, dim);
//return this.nodeHelper.square.contains(npos, pos, dim);
}
}
});
于 2013-03-30T10:41:35.757 回答