diff options
Diffstat (limited to 'app/client/common')
| -rw-r--r-- | app/client/common/slider.component.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/client/common/slider.component.js b/app/client/common/slider.component.js index fccbc5e..cc00650 100644 --- a/app/client/common/slider.component.js +++ b/app/client/common/slider.component.js @@ -25,10 +25,15 @@ class Slider extends Component { let { name, opt } = this.props let old_value = opt[name] let new_value = e.target.value - if (this.props.type === 'int') { + console.log(this.props) + console.log(new_value, this.props.defaultValue) + if (new_value === '') { + new_value = this.props.defaultValue || (this.props.max - this.props.min) / 2 + } + else if (this.props.type === 'int') { new_value = parseInt(new_value) } - if (this.props.type === 'odd') { + else if (this.props.type === 'odd') { new_value = parseInt(Math.floor(new_value / 2) * 2 + 1) } if (old_value !== new_value) { |
