Fixes origin of node-details-panel expanding animation

This commit is contained in:
Simon Howe
2016-08-09 20:16:23 +02:00
parent 8f4b3ab97d
commit 4d5d0d5dc2

View File

@@ -62,6 +62,7 @@ class Node extends React.Component {
this.handleMouseClick = this.handleMouseClick.bind(this);
this.handleMouseEnter = this.handleMouseEnter.bind(this);
this.handleMouseLeave = this.handleMouseLeave.bind(this);
this.saveShapeRef = this.saveShapeRef.bind(this);
this.state = {
hovered: false,
matched: false
@@ -139,7 +140,7 @@ class Node extends React.Component {
</div>
</foreignObject>}
<g {...mouseEvents}>
<g {...mouseEvents} ref={this.saveShapeRef}>
<NodeShapeType
size={size}
color={color}
@@ -152,10 +153,14 @@ class Node extends React.Component {
);
}
saveShapeRef(ref) {
this.shapeRef = ref;
}
handleMouseClick(ev) {
ev.stopPropagation();
this.props.clickNode(this.props.id, this.props.label,
ReactDOM.findDOMNode(this).getBoundingClientRect());
ReactDOM.findDOMNode(this.shapeRef).getBoundingClientRect());
}
handleMouseEnter() {