1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-18 22:41:49 +02:00
This commit is contained in:
Pomax
2016-09-14 14:55:46 -07:00
parent d7d1df1119
commit b9e1d711fd
15 changed files with 538 additions and 74 deletions

View File

@@ -0,0 +1,39 @@
var React = require('react');
var KnotController = React.createClass({
getInitialState() {
return {
owner: false,
knots: []
};
},
bindKnots(owner, knots) {
this.setState({owner, knots});
},
render() {
var type = 'range';
var min = 0;
var max = this.state.knots.length;
var step = 1;
return (
<section className='knot-controls'><h2>knot values</h2>{
this.state.knots.map((value,position) => {
var props = {
type, min, max, step,
value,
onChange: e => {
var k = this.state.knots;
k[position] = e.target.value;
this.setState({ knots: k }, () => {
this.state.owner.redraw();
});
}
};
return <div key={'knot'+position}>{min}<input {...props}/>{max} (= {value})</div>;
})
}</section>
);
}
});
module.exports = KnotController;