Auto-centering inside treeContainer when tree is changed
Are you reporting a bug, or opening a feature request?
May be a feature request or just help with implementation
What is the actual behavior/output?
I'm centering the tree using the suggested method. The user then scrolls the page to select a node off to the side of the graph. I then replace the "data" element of the Tree with a smaller subsection of the entire tree. It renders correctly, but now the tree is in the old centered position which is outside of the window (so the user sees a blank screen)
What is the behavior/output you expect?
I'd like to reset the Tree's translation, however, getBoundingClientRect() does not appear to be updated even when I change the Tree's data field. Is there a way for me to cause this to be recalculated when the Tree is changed? Thank you!
What version of react-d3-tree are you using
1.12.2
+1
+1
+1
It's a bit of a trick, but I don't know if it might help.
this.setState({ translate: { x: 0, y: 0 } });
this.setState({
translate: {
y: 100,
x: dimensions.width / 2
}
});