0
我正在創建自定義節點,我想突出顯示鼠標輸入。不幸的是,mouseEnter
事件不會觸發。我也不知道如何在mouseEnter
和mouseLeave
之後渲染節點。突出顯示鼠標上的自定義節點輸入
我正在創建自定義節點,我想突出顯示鼠標輸入。不幸的是,mouseEnter
事件不會觸發。我也不知道如何在mouseEnter
和mouseLeave
之後渲染節點。突出顯示鼠標上的自定義節點輸入
您是否在自定義節點類型定義中編寫了「contains」函數和「render」函數?如果你還沒有像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);
}
}
});