From b19ebab84c13edadee0f2d6033e9b50b37842d17 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 May 2018 19:16:14 +0200 Subject: seek to a frame --- app/client/live/reducer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/client/live/reducer.js') diff --git a/app/client/live/reducer.js b/app/client/live/reducer.js index df227e4..e056808 100644 --- a/app/client/live/reducer.js +++ b/app/client/live/reducer.js @@ -8,6 +8,7 @@ const liveInitialState = { checkpoint_dir: ['latest'], sequences: [], fps: 0, + frame: { i: 0, sequence_i: 0, sequence_len: '1' } } const liveReducer = (state = liveInitialState, action) => { @@ -44,7 +45,7 @@ const liveReducer = (state = liveInitialState, action) => { case 'LIST_EPOCHS': return { ...state, - epochs: action.epochs.map(a => [ a == 'latest' ? Infinity : a, a ]) + epochs: (action.epochs || []).map(a => [ a == 'latest' ? Infinity : a, a ]) .sort((a,b) => a[0] - b[0]) .map(a => a[1]) } @@ -61,6 +62,12 @@ const liveReducer = (state = liveInitialState, action) => { fps: action.fps, } + case 'CURRENT_FRAME': + return action.meta ? { + ...state, + frame: action.meta + } : state + default: return state } -- cgit v1.2.3-70-g09d2