@@ -35,21 +35,24 @@ class Tree extends React.Component {
35
35
tree : null ,
36
36
treeToo : null
37
37
} ;
38
+
38
39
/* bind callbacks */
39
40
this . clearSelectedNode = callbacks . clearSelectedNode . bind ( this ) ;
40
- // this.handleIconClickHOF = callbacks.handleIconClickHOF.bind(this);
41
- this . redrawTree = ( ) => {
42
- this . props . dispatch ( updateVisibleTipsAndBranchThicknesses ( {
43
- root : [ 0 , 0 ]
44
- } ) ) ;
45
- } ;
46
- /* pressing the escape key should dismiss an info modal (if one exists) */
47
- this . handlekeydownEvent = ( event ) => {
48
- if ( event . key === "Escape" && this . props . selectedNode ) {
49
- this . clearSelectedNode ( this . props . selectedNode ) ;
50
- }
51
- } ;
52
41
}
42
+
43
+ redrawTree = ( ) => {
44
+ this . props . dispatch ( updateVisibleTipsAndBranchThicknesses ( {
45
+ root : [ 0 , 0 ]
46
+ } ) ) ;
47
+ }
48
+
49
+ /* pressing the escape key should dismiss an info modal (if one exists) */
50
+ handlekeydownEvent = ( event ) => {
51
+ if ( event . key === "Escape" && this . props . selectedNode ) {
52
+ this . clearSelectedNode ( this . props . selectedNode ) ;
53
+ }
54
+ }
55
+
53
56
setUpAndRenderTreeToo ( props , newState ) {
54
57
/* this.setState(newState) will be run sometime after this returns */
55
58
/* modifies newState in place */
@@ -59,6 +62,7 @@ class Tree extends React.Component {
59
62
}
60
63
renderTree ( this , false , newState . treeToo , props ) ;
61
64
}
65
+
62
66
componentDidMount ( ) {
63
67
document . addEventListener ( 'keyup' , this . handlekeydownEvent ) ;
64
68
if ( this . props . tree . loaded ) {
@@ -72,6 +76,7 @@ class Tree extends React.Component {
72
76
this . setState ( newState ) ; /* this will trigger an unnecessary CDU :( */
73
77
}
74
78
}
79
+
75
80
componentDidUpdate ( prevProps ) {
76
81
let newState = { } ;
77
82
let rightTreeUpdated = false ;
@@ -110,16 +115,13 @@ class Tree extends React.Component {
110
115
}
111
116
112
117
getStyles = ( ) => {
113
- const activeResetTreeButton = this . props . tree . idxOfInViewRootNode !== 0 ||
114
- this . props . treeToo . idxOfInViewRootNode !== 0 ;
115
-
116
118
const filteredTree = ! ! this . props . tree . idxOfFilteredRoot &&
117
119
this . props . tree . idxOfInViewRootNode !== this . props . tree . idxOfFilteredRoot ;
118
120
const filteredTreeToo = ! ! this . props . treeToo . idxOfFilteredRoot &&
119
121
this . props . treeToo . idxOfInViewRootNode !== this . props . treeToo . idxOfFilteredRoot ;
120
122
const activeZoomButton = filteredTree || filteredTreeToo ;
121
123
122
- const treeIsZoomed = this . props . tree . idxOfInViewRootNode !== 0 ||
124
+ const anyTreeZoomed = this . props . tree . idxOfInViewRootNode !== 0 ||
123
125
this . props . treeToo . idxOfInViewRootNode !== 0 ;
124
126
125
127
return {
@@ -133,8 +135,8 @@ class Tree extends React.Component {
133
135
zIndex : 100 ,
134
136
display : "inline-block" ,
135
137
marginLeft : 4 ,
136
- cursor : activeResetTreeButton ? "pointer" : "auto" ,
137
- color : activeResetTreeButton ? darkGrey : lightGrey
138
+ cursor : anyTreeZoomed ? "pointer" : "auto" ,
139
+ color : anyTreeZoomed ? darkGrey : lightGrey
138
140
} ,
139
141
zoomToSelectedButton : {
140
142
zIndex : 100 ,
@@ -146,9 +148,9 @@ class Tree extends React.Component {
146
148
zoomOutButton : {
147
149
zIndex : 100 ,
148
150
display : "inline-block" ,
149
- cursor : treeIsZoomed ? "pointer" : "auto" ,
150
- color : treeIsZoomed ? darkGrey : lightGrey ,
151
- pointerEvents : treeIsZoomed ? "auto" : "none" ,
151
+ cursor : anyTreeZoomed ? "pointer" : "auto" ,
152
+ color : anyTreeZoomed ? darkGrey : lightGrey ,
153
+ pointerEvents : anyTreeZoomed ? "auto" : "none" ,
152
154
marginRight : "4px"
153
155
}
154
156
} ;
0 commit comments