From b92b633cf0c2d528e45c04828a9ce1f5679aeaa3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 6 Jun 2018 04:16:37 +0200 Subject: frame count slider --- app/client/common/slider.component.js | 6 +-- app/client/modules/pix2pix/views/pix2pix.live.js | 32 +++++++-------- .../modules/pix2wav/views/spectrogram.upload.js | 45 ++++++++++++++-------- 3 files changed, 47 insertions(+), 36 deletions(-) (limited to 'app') diff --git a/app/client/common/slider.component.js b/app/client/common/slider.component.js index 942640a..fccbc5e 100644 --- a/app/client/common/slider.component.js +++ b/app/client/common/slider.component.js @@ -10,7 +10,7 @@ class Slider extends Component { super(props) this.timeout = 0 this.state = { - value: props.opt[props.name] + value: props.live ? props.opt[props.name] : props.value } this.handleInput = this.handleInput.bind(this) this.handleRange = this.handleRange.bind(this) @@ -33,7 +33,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.live && this.props.actions.set_param(this.props.name, new_value) this.props.onChange && this.props.onChange(new_value) } clearTimeout(this.timeout) @@ -49,7 +49,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.live && this.props.actions.set_param(this.props.name, new_value) this.props.onChange && this.props.onChange(new_value) }, SLIDER_THROTTLE_TIME) } diff --git a/app/client/modules/pix2pix/views/pix2pix.live.js b/app/client/modules/pix2pix/views/pix2pix.live.js index fc6bc9b..eebb364 100644 --- a/app/client/modules/pix2pix/views/pix2pix.live.js +++ b/app/client/modules/pix2pix/views/pix2pix.live.js @@ -93,7 +93,7 @@ class Pix2PixLive extends Component { options={this.props.epochs} onChange={this.changeEpoch} /> - - - - @@ -148,15 +148,15 @@ class Pix2PixLive extends Component { title='Recursion' name='recursive' > - - - @@ -166,11 +166,11 @@ class Pix2PixLive extends Component { title='Sequence' name='sequence' > - - @@ -181,7 +181,7 @@ class Pix2PixLive extends Component { title='Clahe' name='clahe' > - @@ -191,11 +191,11 @@ class Pix2PixLive extends Component { title='Posterize' name='posterize' > - - @@ -205,11 +205,11 @@ class Pix2PixLive extends Component { title='Blur' name='blur' > - - @@ -219,11 +219,11 @@ class Pix2PixLive extends Component { title='Canny Edge Detection' name='canny' > - - diff --git a/app/client/modules/pix2wav/views/spectrogram.upload.js b/app/client/modules/pix2wav/views/spectrogram.upload.js index 0279e80..087af6a 100644 --- a/app/client/modules/pix2wav/views/spectrogram.upload.js +++ b/app/client/modules/pix2wav/views/spectrogram.upload.js @@ -9,7 +9,7 @@ import * as pix2wavTasks from '../pix2wav.tasks' import { Loading, Progress, - Group, Param, FileUpload, TextInput, Button + Group, Param, FileUpload, TextInput, Button, Slider, } from '../../../common' import * as datasetActions from '../../../dataset/dataset.actions' @@ -24,6 +24,7 @@ class SpectrogramUpload extends Component { file: null, name: "", frames: [], + max: 3000, } const audioElement = document.createElement('audio') audioElement.addEventListener('loadedmetadata', () => { @@ -66,7 +67,6 @@ class SpectrogramUpload extends Component { // module={pix2wavModule} // data={pix2wav.data} // folder={folder} - console.log(this.props) const { file, frames } = this.state return (
@@ -98,21 +98,32 @@ class SpectrogramUpload extends Component {

Careful, your file is larger than 2 MB.

} - {file.name} - {file.type} - {size[1]} - {moment(file.lastModifiedDate).format("YYYY-MM-DD h:mm a")} - {Math.floor(duration) + ' s.'} -
- {this.props.pix2wav.status}{this.props.upload.status} - this.setState({ name: e.target.value })} - value={this.state.name} - /> - + + {file.name} + {file.type} + {size[1]} + {moment(file.lastModifiedDate).format("YYYY-MM-DD h:mm a")} + {Math.floor(duration) + ' s.'} +
+ {this.props.pix2wav.status}{this.props.upload.status} +
+
+ + this.setState({ name: e.target.value })} + value={this.state.name} + /> + this.setState({ max })} + /> + +
) -- cgit v1.2.3-70-g09d2