Skip to content

Commit 2a540f9

Browse files
committed
Ensures component regresses to origin onLeave
1 parent 58420d8 commit 2a540f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Node/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default class Node extends React.Component {
1313

1414
componentDidMount() {
1515
const { x, y, parent } = this.props.nodeData;
16-
console.log(this.props.nodeData);
1716
const originX = parent ? parent.x : 0;
1817
const originY = parent ? parent.y : 0;
1918

@@ -48,11 +47,13 @@ export default class Node extends React.Component {
4847

4948
componentWillLeave(done) {
5049
const { parent } = this.props.nodeData;
50+
const originX = parent ? parent.x : 0;
51+
const originY = parent ? parent.y : 0;
5152

5253
select(this.node)
5354
.transition()
5455
.duration(500)
55-
.attr('transform', this.setTransformOrientation(parent.x, parent.y))
56+
.attr('transform', this.setTransformOrientation(originX, originY))
5657
.each('end', done);
5758
}
5859

0 commit comments

Comments
 (0)