diff options
Diffstat (limited to 'app/client')
| -rw-r--r-- | app/client/common/slider.component.js | 6 | ||||
| -rw-r--r-- | app/client/live/actions.js | 2 | ||||
| -rw-r--r-- | app/client/live/index.js | 12 |
3 files changed, 8 insertions, 12 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(){ diff --git a/app/client/live/actions.js b/app/client/live/actions.js index 46e0c6c..5bf06eb 100644 --- a/app/client/live/actions.js +++ b/app/client/live/actions.js @@ -38,5 +38,5 @@ export const load_epoch = (checkpoint, epoch) => { export const seek = (frame) => { socket.seek(frame) - return { type: 'LOADING_CHECKPOINT', } + return { type: 'SEEKING', } } diff --git a/app/client/live/index.js b/app/client/live/index.js index f632836..fb512a3 100644 --- a/app/client/live/index.js +++ b/app/client/live/index.js @@ -21,11 +21,7 @@ class App extends Component { this.seek = this.seek.bind(this) } componentWillUpdate(nextProps) { - console.log('willupdate', nextProps.opt) - if (! nextProps.epochs || nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { - this.props.actions.list_epochs(nextProps.opt.checkpoint_name) - } - if (! nextProps.epochs || nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { + if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { this.props.actions.list_epochs(nextProps.opt.checkpoint_name) } } @@ -40,7 +36,7 @@ class App extends Component { this.props.actions.load_sequence(sequence) } seek(percentage){ - const frame = Math.floor(percentage * (this.props.opt.frame.sequence_len || 1) + 1 + const frame = Math.floor(percentage * (parseInt(this.props.frame.sequence_len) || 1) + 1) this.props.actions.seek(frame) } render(){ @@ -79,7 +75,7 @@ class App extends Component { <Slider name='position' min={0.0} max={1.0} type='float' - value={(this.opt.frame.sequence_i || 0) / (this.opt.frame.sequence_len || 1)} + value={(this.props.frame.sequence_i || 0) / (this.props.frame.sequence_len || 1)} onChange={this.seek} /> </ParamGroup> @@ -197,7 +193,7 @@ class App extends Component { const mapStateToProps = state => ({ opt: state.live.opt, - frame: state.live.frame + frame: state.live.frame, checkpoints: state.live.checkpoints, epochs: state.live.epochs, sequences: state.live.sequences, |
