1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-29 02:59:58 +02:00

t-value control

This commit is contained in:
Pomax
2018-06-23 23:22:58 -07:00
parent 1da8c3966b
commit 3d334c2559
13 changed files with 4301 additions and 1907 deletions

42
components/SliderSet.jsx Normal file
View File

@@ -0,0 +1,42 @@
var React = require("react");
class SliderSet extends React.Component {
constructor(props) {
super(props);
this.options = props.options || [];
}
render(props) {
var min = props.min || 0;
var max = props.max || 1;
var step = props.step || (max-min) / 100;
var rows = this.options;
var sliders = rows.map( (v,i) => {
return (
<div>
<label>t<sub>{ i }</sub></label>
<input
type="range"
key={`row${i}`}
min={min}
max={max}
defaultValue={v}
step={step}
onChange={e => {
this.options[i] = e.target.value;
props.onChange(i, this.options);
}} />
<span>{ parseFloat(v).toFixed(2) }</span>
</div>
);
});
return <div>{ sliders }</div>;
}
setOptions(options, labels) {
this.options = options;
this.forceUpdate();
}
}
module.exports = SliderSet;