@@ -7,7 +7,7 @@ import { getGroupColor } from "../utils";
77import FullScreenButton from "./FullScreenButton.tsx" ;
88import { useCallback , useEffect , useRef , useState } from "react" ;
99import ResetViewButton from "./ResetViewButton.tsx" ;
10- import ThemeSwitch from "./ThemeSwitch.tsx" ;
10+ import ThemeSwitch from "./ThemeSwitch.tsx" ;
1111interface GraphProps {
1212 graphData : GraphData ;
1313 width : number ;
@@ -26,15 +26,14 @@ const Graph: React.FC<GraphProps> = ({ graphData, width, height }) => {
2626 const handleClick = useCallback (
2727 ( node : NodeObject ) => {
2828 if ( ! node || node . x === undefined || node . y === undefined || node . z === undefined ) return ;
29- if ( ! fgRef . current ) return ;
30-
31- const distance = 80 ;
32- const distRatio = 1 + distance / Math . hypot ( node . x , node . y , node . z ) ;
33-
34- fgRef . current . cameraPosition (
35- { x : node . x * distRatio , y : node . y * distRatio , z : node . z * distRatio } ,
36- node ,
37- 2000
29+ // copy node´s id to clipboard
30+ navigator . clipboard . writeText ( ( node . id ?? "" ) . toString ( ) ) . then (
31+ ( ) => {
32+ console . log ( "Node ID copied to clipboard: " , node . id ) ;
33+ } ,
34+ ( err ) => {
35+ console . error ( "Could not copy text: " , err ) ;
36+ }
3837 ) ;
3938 } ,
4039 [ fgRef ]
@@ -97,7 +96,9 @@ const Graph: React.FC<GraphProps> = ({ graphData, width, height }) => {
9796 graphData = { graphData }
9897 width = { graphWidth }
9998 height = { graphHeight }
100- nodeLabel = { ( node : NodeObject ) => `<span style="color: ${ labelColor } ">${ node . label || node . id } </span>` }
99+ nodeLabel = { ( node : NodeObject ) =>
100+ `<span style="color: ${ labelColor } ">${ node . label || node . id } </span>`
101+ }
101102 linkLabel = { ( d : LinkObject ) => `<span style="color: ${ labelColor } ">${ d . label } </span>` }
102103 linkDirectionalArrowLength = { 7 }
103104 linkDirectionalArrowRelPos = { 1 }
0 commit comments