File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,7 @@ export default class Node extends React.Component {
35
35
}
36
36
37
37
setTransformOrientation ( x , y ) {
38
- const { orientation, nodeData, depthFactor } = this . props ;
39
-
40
- if ( depthFactor ) {
41
- y = nodeData . depth * depthFactor ;
42
- }
43
-
44
- return orientation === 'horizontal' ?
38
+ return this . props . orientation === 'horizontal' ?
45
39
`translate(${ y } ,${ x } )` :
46
40
`translate(${ x } ,${ y } )` ;
47
41
}
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ export default class Tree extends React.Component {
192
192
* @return {object } Object containing `nodes` and `links` fields.
193
193
*/
194
194
generateTree ( ) {
195
- const { initialDepth } = this . props ;
195
+ const { initialDepth, depthFactor } = this . props ;
196
196
const tree = layout . tree ( )
197
197
. nodeSize ( [ 100 + 40 , 100 + 40 ] )
198
198
. separation ( ( d ) => d . _children ? 1.2 : 0.9 )
@@ -207,6 +207,10 @@ export default class Tree extends React.Component {
207
207
this . setInitialTreeDepth ( nodes , initialDepth ) ;
208
208
}
209
209
210
+ if ( depthFactor ) {
211
+ nodes . forEach ( ( node ) => { node . y = node . depth * depthFactor ; } ) ;
212
+ }
213
+
210
214
return { nodes, links } ;
211
215
}
212
216
You can’t perform that action at this time.
0 commit comments