Files
weave-scope/client/app/scripts/charts/edge.js
Simon Howe c46bacab1b Improve highlighting performance.
- Untangle edge dependencies so we don't redraw them all if a node is
  highlighted.
- Only "preparePoints" if they've changed.
2016-04-06 21:50:27 +02:00

39 lines
1.0 KiB
JavaScript

import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import reactMixin from 'react-mixin';
import classNames from 'classnames';
import { enterEdge, leaveEdge } from '../actions/app-actions';
export default class Edge extends React.Component {
constructor(props, context) {
super(props, context);
this.handleMouseEnter = this.handleMouseEnter.bind(this);
this.handleMouseLeave = this.handleMouseLeave.bind(this);
}
render() {
const { id, path, highlighted, blurred, focused } = this.props;
const className = classNames('edge', {highlighted, blurred, focused});
return (
<g className={className} onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave} id={id}>
<path d={path} className="shadow" />
<path d={path} className="link" />
</g>
);
}
handleMouseEnter(ev) {
enterEdge(ev.currentTarget.id);
}
handleMouseLeave(ev) {
leaveEdge(ev.currentTarget.id);
}
}
reactMixin.onClass(Edge, PureRenderMixin);