@@ -7,128 +7,6 @@ import { useTooltipInPortal } from '@visx/tooltip';
77import LinkControls from './axLinkControls' ;
88import getLinkComponent from './getAxLinkComponents' ;
99
10- const theme = {
11- scheme : 'monokai' ,
12- author : 'wimer hazenberg (http://www.monokai.nl)' ,
13- base00 : '#272822' ,
14- base01 : '#383830' ,
15- base02 : '#49483e' ,
16- base03 : '#75715e' ,
17- base04 : '#a59f85' ,
18- base05 : '#f8f8f2' ,
19- base06 : '#f5f4f1' ,
20- base07 : '#f9f8f5' ,
21- base08 : '#f92672' ,
22- base09 : '#fd971f' ,
23- base0A : '#f4bf75' ,
24- base0B : '#a6e22e' ,
25- base0C : '#a1efe4' ,
26- base0D : '#66d9ef' ,
27- base0E : '#ae81ff' ,
28- base0F : '#cc6633' ,
29- } ;
30-
31- interface TreeNode {
32- name ?: {
33- sources ?: any [ ] ;
34- type ?: string ;
35- value ?: string ;
36- } ;
37- isExpanded ?: boolean ;
38- children ?: TreeNode [ ] ;
39- backendDOMNodeId ?: number ;
40- childIds ?: string [ ] ;
41- ignored ?: boolean ;
42- nodeId ?: string ;
43- ignoredReasons ?: any [ ] ;
44- }
45-
46- // example data from visx
47-
48- // pulling name property value to name the node, need to adjust data pull from ax tree to reassign name if the node is ignored
49-
50- const data : TreeNode = {
51- name : {
52- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
53- type : "computedString" ,
54- value : "Reactime MVP"
55- } ,
56- backendDOMNodeId : 1 ,
57- childIds : [ '46' ] ,
58- ignored : false ,
59- children : [ {
60- name : {
61- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
62- type : "computedString" ,
63- value : ""
64- } ,
65- backendDOMNodeId : 7 ,
66- childIds : [ '47' ] ,
67- ignored : true ,
68- } , {
69- name : {
70- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
71- type : "computedString" ,
72- value : "Tic-Tac-Toe"
73- } ,
74- backendDOMNodeId : 8 ,
75- childIds : [ '48' ] ,
76- ignored : false ,
77- } ] ,
78- } ;
79-
80- const nodeAxArr = [
81- {
82- name : {
83- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
84- type : "computedString" ,
85- value : "Reactime MVP"
86- } ,
87- backendDOMNodeId : 1 ,
88- childIds : [ '46' ] ,
89- ignored : false ,
90- children : [ {
91- name : {
92- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
93- type : "computedString" ,
94- value : ""
95- } ,
96- backendDOMNodeId : 7 ,
97- childIds : [ '47' ] ,
98- ignored : true ,
99- } , {
100- name : {
101- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
102- type : "computedString" ,
103- value : "Tic-Tac-Toe"
104- } ,
105- backendDOMNodeId : 8 ,
106- childIds : [ '48' ] ,
107- ignored : false ,
108- } ] ,
109- } ,
110- {
111- name : {
112- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
113- type : "computedString" ,
114- value : ""
115- } ,
116- backendDOMNodeId : 7 ,
117- childIds : [ '47' ] ,
118- ignored : true ,
119- } ,
120- {
121- name : {
122- sources : [ { attribute : 'aria-labelledby' , type : 'relatedElement' } ] ,
123- type : "computedString" ,
124- value : "Tic-Tac-Toe"
125- } ,
126- backendDOMNodeId : 8 ,
127- childIds : [ '48' ] ,
128- ignored : false ,
129- }
130- ]
131-
13210const defaultMargin = {
13311 top : 30 ,
13412 left : 30 ,
@@ -191,41 +69,16 @@ export default function AxTree(props) {
19169 }
19270 }
19371
194- console . log ( 'size width height ax: ' , sizeWidth , sizeHeight ) ;
195-
19672 const LinkComponent = getLinkComponent ( { layout, linkType, orientation } ) ;
19773
19874 const currAxSnapshot = JSON . parse ( JSON . stringify ( axSnapshots [ currLocation . index ] ) ) ;
199- console . log ( 'currAxSnapshot: ' , currAxSnapshot ) ;
20075
20176 // root node of currAxSnapshot
20277 const rootAxNode = JSON . parse ( JSON . stringify ( currAxSnapshot [ 0 ] ) ) ;
20378
204- // // array that holds the ax tree as a nested object and the root node initially
79+ // array that holds the ax tree as a nested object and the root node initially
20580 const nodeAxArr = [ ] ;
20681
207- // currNode.children = [];
208- // // checks if there is more than 1 child
209- // if (currNode.childIds.length > 1) {
210- // for (let m = 0; m < currNode.childIds.length; m++) {
211- // for (let j = 0; j < currAxSnapshot.length; j++) {
212- // if (currNode.childIds.includes(currAxSnapshot[j].nodeId)) {
213- // currNode.children.push(currAxSnapshot[j]);
214- // }
215- // }
216- // }
217- // } else if (currNode.childIds.length === 1) {
218- // for (let j = 0; j < currAxSnapshot.length; j++) {
219- // if (currNode.childIds.includes(currAxSnapshot[j].nodeId)) {
220- // currNode.children.push(currAxSnapshot[j]);
221- // }
222- // }
223- // organizeAxTree(currNode.children[0], currAxSnapshot);
224- // }
225- // organizeAxTree(currNode.children, currAxSnapshot);
226- // }
227-
228- // organizeAxTree([rootAxNode], currAxSnapshot);
22982 const organizeAxTree = ( currNode , currAxSnapshot ) => {
23083 if ( currNode . childIds && currNode . childIds . length > 0 ) {
23184 currNode . children = [ ] ;
0 commit comments