diff options
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(){ |
