From a952ae8a1633b7650d5d3c51ba51b3e16a8639ad Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 May 2018 13:34:26 +0200 Subject: player is working and its dope --- app/client/common/slider.component.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/client/common/slider.component.js') 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) -- cgit v1.2.3-70-g09d2