Fix edge end node not regestering

This commit is contained in:
futpib 2018-11-14 20:04:31 +03:00
parent 082fbdd2f5
commit d79edc4206

View File

@ -40,6 +40,9 @@ class GraphView extends GraphViewBase {
_super_getNodeComponent: this.getNodeComponent,
getNodeComponent: this.constructor.prototype.getNodeComponent.bind(this),
_super_handleNodeMouseEnter: this.handleNodeMouseEnter,
handleNodeMouseEnter: this.constructor.prototype.handleNodeMouseEnter.bind(this),
});
}
@ -105,6 +108,24 @@ class GraphView extends GraphViewBase {
}
}
handleNodeMouseEnter(event, data, hovered) {
if (hovered && !this.state.hoveredNode) {
this.setState({
hoveredNode: true,
hoveredNodeData: data,
});
} else if (!hovered && this.state.draggingEdge) {
this.setState({
edgeEndNode: data,
});
} else {
this.setState({
hoveredNode: true,
hoveredNodeData: data,
});
}
}
getEdgeComponent(edge, nodeMoving) {
if (!this.props.renderEdge) {
return this._super_getEdgeComponent(edge);