2012-07-05 1 views
0

사용자 정의 노드를 작성 중이고 마우스 입력시 강조하고 싶습니다. 불행히도 mouseEnter 이벤트는 발생하지 않습니다. 또한 mouseEntermouseLeave 뒤에 노드를 렌더링하는 방법을 알지 못합니다.마우스 사용자 정의 노드 입력

답변

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); 
     } 
    } 
});