var React = require('react')
// , PT = React.PropTypes
function line(obj) {
var {x1, y1, x2, y2} = obj
return 'M' + parseInt(x1) + ' ' + parseInt(y1) + ' L' + parseInt(x2) + ' ' + parseInt(y2)
}
var MindmapLinks = React.createClass({
componentDidMount() {
// this.renderCanvas()
},
componentDidUpdate() {
// this.renderCanvas()
},
renderCanvas() {
var ctx = this._node.getContext('2d')
ctx.clearRect(0, 0, this.props.width, this.props.height)
ctx.strokeStyle='red'
ctx.lineWidth = 10
var dx = this.props.left
, dy = this.props.top
this.props.links.forEach(link => {
ctx.beginPath()
ctx.moveTo(link.y1 + dx, link.x1 + dy)
ctx.lineTo(link.y2 + dx, link.x2 + dy)
ctx.stroke()
})
},
componentWillReceiveProps: function () {
},
renderSVG() {
return
},
render() {
return this.renderSVG()
// return