@@ -24,7 +24,7 @@ export const useInit = () => {
2424 const height = containerRef . current . offsetHeight ;
2525 let graph : ForceGraphInstance | ForceGraph3DInstance | null = null ;
2626 engineStopped . current = false ;
27- console . log ( 'init.......' ) ;
27+
2828 if ( render === '2D' ) {
2929 graph = ForceGraph ( ) ( containerRef . current ) ;
3030 graph
@@ -45,6 +45,9 @@ export const useInit = () => {
4545 } )
4646 . onLinkClick ( edge => {
4747 emitterRef . current ?. emit ( 'edge:click' , edge ) ;
48+ } )
49+ . onLinkHover ( edge => {
50+ emitterRef . current ?. emit ( 'edge:hover' , edge ) ;
4851 } ) ;
4952 }
5053 if ( render === '3D' ) {
@@ -55,6 +58,9 @@ export const useInit = () => {
5558 . onNodeClick ( node => {
5659 emitterRef . current ?. emit ( 'node:click' , node ) ;
5760 } )
61+ . onNodeHover ( ( node , prevNode ) => {
62+ emitterRef . current ?. emit ( 'node:hover' , { node, prevNode } ) ;
63+ } )
5864 . onNodeRightClick ( ( node , evt ) => {
5965 emitterRef . current ?. emit ( 'node:contextmenu' , { node, evt } ) ;
6066 } )
@@ -63,6 +69,9 @@ export const useInit = () => {
6369 } )
6470 . onLinkClick ( edge => {
6571 emitterRef . current ?. emit ( 'edge:click' , edge ) ;
72+ } )
73+ . onLinkHover ( ( edge , prevEdge ) => {
74+ emitterRef . current ?. emit ( 'edge:hover' , { edge, prevEdge } ) ;
6675 } ) ;
6776 }
6877
0 commit comments