diff options
Diffstat (limited to 'app/client/common/slider.component.js')
| -rw-r--r-- | app/client/common/slider.component.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/client/common/slider.component.js b/app/client/common/slider.component.js index ca22689..1fedbfb 100644 --- a/app/client/common/slider.component.js +++ b/app/client/common/slider.component.js @@ -28,6 +28,9 @@ class Slider extends Component { if (this.props.type === 'int') { new_value = parseInt(new_value) } + if (this.props.type === 'odd') { + new_value = parseInt(Math.floor(new_value / 2) * 2 + 1) + } if (old_value !== new_value) { this.setState({ value: new_value }) this.props.actions.set_param(this.props.name, new_value) @@ -40,6 +43,9 @@ class Slider extends Component { if (this.props.type === 'int') { new_value = parseInt(new_value) } + if (this.props.type === 'odd') { + new_value = parseInt(Math.floor(new_value / 2) * 2 + 1) + } this.setState({ value: new_value }) this.timeout = setTimeout(() => { this.props.actions.set_param(this.props.name, new_value) |
