@@ -30,18 +30,6 @@ function fold (tree) {
3030 parent : tree
3131 } ) ;
3232 }
33- // let rest = tree.children.splice(MAX_CHILDREN);
34- // tree.children.push({
35- // label: `${ rest.length } more`,
36- // type: "folder",
37- // edgeType: rest[0].edgeType,
38- // _children: rest,
39- // children: [],
40- // radius: 10,
41- // entities: [],
42- // id: additionalNodeId--,
43- // parent: tree
44- // });
4533 return tree ;
4634}
4735
@@ -115,12 +103,11 @@ function preprocess (graph) {
115103 }
116104 graph . nodes . forEach ( node =>
117105 node . radius = MIN_RADIUS + Math . sqrt ( node . entities [ 0 ] [ SIZE_CRITERIA ] / 4 || 25 ) ) ;
118- console . log ( `Graph:` , graph ) ;
119- let tree = toTree ( graph , zeroID ) ,
120- foldedTree = fold ( tree ) ;
121- console . log ( `Tree:` , tree ) ;
106+ // console.log(`Graph:`, graph);
107+ let tree = toTree ( graph , zeroID ) ;
108+ // console.log(`Tree:`, tree);
122109
123- return foldedTree ;
110+ return fold ( tree ) ;
124111
125112}
126113
@@ -201,61 +188,6 @@ function resetChildrenPosition (folder, children = []) {
201188 }
202189}
203190
204- // /**
205- // * Replaces the tree object, because D3.js does not sensitive to the property changes.
206- // * @param id - ID of the node in the graph
207- // * @param assign - New properties to assign.
208- // */
209- // export function assignNodeId (id, assign = {}) {
210- //
211- // function rec (parent = null, tree = graph, i) {
212- // if (tree.id === id) {
213- // if (parent === null) {
214- // graph = Object.assign(Object.assign({}, tree), assign);
215- // return true;
216- // } else {
217- // parent.children[i] = Object.assign(Object.assign({}, tree), assign);
218- // return true;
219- // }
220- // }
221- // for (let c = 0; c < tree.children.length; c++) {
222- // if (rec(tree, tree.children[c], c) === true)
223- // return true;
224- // }
225- // return false;
226- // }
227- //
228- // let res = rec();
229- // console.log(res);
230- // if (res)
231- // updateCallbacks.forEach(cb => cb(graph));
232- //
233- // }
234- //
235- // function getNodeById (id) {
236- //
237- // let target = null;
238- //
239- // function recurse (node) {
240- // if (node.id === id) {
241- // target = node;
242- // return true;
243- // }
244- // if (node.children) {
245- // for (let n of node.children) {
246- // if (recurse(n))
247- // return true;
248- // }
249- // }
250- // return false;
251- // }
252- //
253- // recurse(graph);
254- //
255- // return target;
256- //
257- // }
258-
259191/**
260192 * Unfold the folder by specified amount of nodes.
261193 * @param folderNode - Node representing a folder
0 commit comments