You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const[layout,setLayout]=useState('cartesian');// We create a local state "layout" and set it to a string 'cartesian'
42
+
const[orientation,setOrientation]=useState('vertical');// We create a local state "orientation" and set it to a string 'vertical'.
43
+
const[linkType,setLinkType]=useState('diagonal');// We create a local state "linkType" and set it to a string 'diagonal'.
44
+
const[stepPercent,setStepPercent]=useState(10);// We create a local state "stepPercent" and set it to a number '10'.
45
+
const[selectedNode,setSelectedNode]=useState('root');// We create a local state "selectedNode" and set it to a string 'root'.
46
+
const[,dispatch]=useStoreContext();// we destructure the returned context object from the invocation of the useStoreContext function to get access to our dispatch function
47
+
48
+
consttoolTipTimeoutID=useRef(null);//useRef stores stateful data that’s not needed for rendering.
48
49
49
50
useEffect(()=>{
50
51
dispatch(setCurrentTabInApp('map'));// dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'map' to facilitate render.
@@ -58,24 +59,28 @@ export default function ComponentMap({
58
59
letsizeWidth: number;
59
60
letsizeHeight: number;
60
61
61
-
// This sets the starting position for the root node on the maps display.
62
-
// the polar layout sets the root node to the relative center of the display box
63
-
// based on the size of the browser window.
64
-
// the else conditional statements determines the root nodes location either in the left middle
65
-
// or top middle of the browser window relative to the size of the browser.
66
-
if(layout==='polar'){
62
+
/*
63
+
This sets the starting position for the root node on the maps display.
64
+
The 'polar layout' sets the root node to the relative center of the display box based on the size of the browser window.
65
+
The 'cartesian layout' (else conditional) sets the root nodes location either in the left middle *or top middle of the browser window relative to the size of the browser.
66
+
*/
67
+
68
+
if(layout==='polar'){// 'polar layout' option
67
69
origin={
68
70
x: innerWidth/2,
69
71
y: innerHeight/2,
70
72
};
73
+
74
+
// set the sizeWidth and sizeHeight
71
75
sizeWidth=2*Math.PI;
72
76
sizeHeight=Math.min(innerWidth,innerHeight)/2;
73
-
}else{
77
+
78
+
}else{// 'cartesian layout' option
74
79
origin={x: 0,y: 0};
75
80
if(orientation==='vertical'){
76
81
sizeWidth=innerWidth;
77
82
sizeHeight=innerHeight;
78
-
}else{
83
+
}else{// if the orientation isn't vertical, swap the width and the height
dispatch(('performance-comparison'));// dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'performance-comparison.' to facilitate render.
52
+
dispatch(setCurrentTabInApp('performance-comparison'));// dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'performance-comparison.' to facilitate render.
0 commit comments