1- const graphElem = document . getElementById ( ' idea-graph' ) ;
1+ const graphElem = document . getElementById ( " idea-graph" ) ;
22const Graph = ForceGraph3D ( ) ( graphElem )
33displayGraph ( ) ;
44
@@ -11,10 +11,11 @@ window.onclick = function (event) {
1111async function displayGraph ( ) {
1212 let newData
1313 try {
14- newData = await getData ( )
14+ newData = await getData ( ) ;
15+ newData . nodes = newData . nodes . map ( node => ( { ...node , tags : new Set ( node . tags ) } ) ) ;
1516 Graph . graphData ( newData )
16- . nodeLabel ( ' name' )
17- . onNodeHover ( node => graphElem . style . cursor = node ? ' pointer' : null )
17+ . nodeLabel ( " name" )
18+ . onNodeHover ( node => graphElem . style . cursor = node ? " pointer" : null )
1819 . onNodeClick ( node => {
1920 // Aim at node from outside it
2021 const distance = 40 ;
@@ -44,10 +45,10 @@ function displayDetail(node) {
4445 detailTags . textContent = [ ...node . tags ] . join ( ', ' ) ;
4546 detailCreator . textContent = node . creator ;
4647 detailDescription . textContent = node . description ;
47-
48- modal . style . top = event . pageY ;
49- modal . style . left = event . pageX ;
50- modal . style . display = ' block' ;
48+
49+ modal . style . top = event . pageY + "px" ;
50+ modal . style . left = event . pageX + "px" ;
51+ modal . style . display = " block" ;
5152}
5253
5354function onAddItemClick ( ) {
@@ -86,7 +87,7 @@ function onModalSubmitClick(event, form) {
8687}
8788
8889function onModalCloseClick ( modal ) {
89- modal . parentElement . style . display = ' none' ;
90+ modal . parentElement . style . display = " none" ;
9091}
9192
9293function matchTags ( newIdea , nodes ) {
@@ -97,4 +98,5 @@ function matchTags(newIdea, nodes) {
9798 newLinks = [ ...newLinks , { source : newIdea . id , target : idea . id } ]
9899 }
99100 }
101+ return newLinks
100102}
0 commit comments