From dd469b4ff7f9945864aa2da0e23fd466334884aa Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 May 2018 19:27:23 +0200 Subject: onchange --- app/client/live/actions.js | 2 +- app/client/live/index.js | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'app/client/live') 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 { @@ -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, -- cgit v1.2.3-70-g09d2