Skip to content

Commit 4fe30ed

Browse files
committed
Moves depthFactor conditional into setTransformOrientation
1 parent 04fc70f commit 4fe30ed

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Node/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ export default class Node extends React.Component {
3535
}
3636

3737
setTransformOrientation(x, y) {
38-
const { orientation } = this.props;
39-
const transform = orientation === 'horizontal' ?
38+
const { orientation, nodeData, depthFactor } = this.props;
39+
40+
if (depthFactor) {
41+
y = nodeData.depth * depthFactor;
42+
}
43+
44+
return orientation === 'horizontal' ?
4045
`translate(${y},${x})` :
4146
`translate(${x},${y})`;
42-
return transform;
4347
}
4448

4549
applyTransform(transform, opacity = 1, done = () => {}) {
@@ -71,16 +75,12 @@ export default class Node extends React.Component {
7175
}
7276

7377
render() {
74-
const { nodeData, depthFactor, transitions } = this.props;
78+
const { nodeData, transitions } = this.props;
7579

7680
const transform = transitions.enabled && this.state.transform ?
7781
this.state.transform :
7882
this.setTransformOrientation(nodeData.x, nodeData.y);
7983

80-
81-
if (depthFactor) {
82-
nodeData.y = nodeData.depth * depthFactor;
83-
}
8484
return (
8585
<g
8686
id={nodeData.id}

0 commit comments

Comments
 (0)