diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-21 19:27:23 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-21 19:27:23 +0200 |
| commit | dd469b4ff7f9945864aa2da0e23fd466334884aa (patch) | |
| tree | f2b61ee34633ce89dee2790ab4d10818bf1fe7b9 /app/client/common/slider.component.js | |
| parent | b19ebab84c13edadee0f2d6033e9b50b37842d17 (diff) | |
onchange
Diffstat (limited to 'app/client/common/slider.component.js')
| -rw-r--r-- | app/client/common/slider.component.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/client/common/slider.component.js b/app/client/common/slider.component.js index fe27c84..174877d 100644 --- a/app/client/common/slider.component.js +++ b/app/client/common/slider.component.js @@ -16,7 +16,7 @@ class Slider extends Component { this.handleRange = this.handleRange.bind(this) } componentWillReceiveProps(nextProps) { - const next_value = nextProps.opt[nextProps.name] + const next_value = nextProps.value || nextProps.opt[nextProps.name] if (next_value !== this.state.value) { this.setState({ value: next_value }); } @@ -34,7 +34,7 @@ class Slider extends Component { if (old_value !== new_value) { this.setState({ value: new_value }) this.props.actions.set_param(this.props.name, new_value) - this.props.onChange(new_value) + this.props.onChange && this.props.onChange(new_value) } clearTimeout(this.timeout) } @@ -50,7 +50,7 @@ class Slider extends Component { this.setState({ value: new_value }) this.timeout = setTimeout(() => { this.props.actions.set_param(this.props.name, new_value) - this.props.onChange(new_value) + this.props.onChange && this.props.onChange(new_value) }, SLIDER_THROTTLE_TIME) } render(){ |
