From 1a9be2d1b16517895ebc01ac1e11a34970079402 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 8 Sep 2020 19:50:08 +0200 Subject: attempting to make an initial curtain element.. --- .../frontend/app/views/viewer/viewer.actions.js | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js') diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 167da97..5d10f2a 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -133,12 +133,39 @@ export const loadSections = () => dispatch => { currentSection.duration = timeline.duration } - // set the end_ts for each section (i.e. just before the next section starts) + let time_to_first_fullscreen_element, initial_curtain_event + // last fixes on the sections for (let i = 0; i < sections.length - 1; i++) { currentSection = sections[i] + // set the end_ts for each section (i.e. just before the next section starts) if (currentSection.end_ts === 0) { currentSection.end_ts = sections[i+1].start_ts - 1 } + // if the first fullscreen event is close to the beginning of the section, move it there + time_to_first_fullscreen_element = 0 + if (currentSection.fullscreenTimeline.length) { + time_to_first_fullscreen_element = Math.abs(currentSection.fullscreenTimeline[0].start_ts - currentSection.start_ts) + if (time_to_first_fullscreen_element < 1.0) { + currentSection.fullscreenTimeline[0].start_ts = currentSection.start_ts + time_to_first_fullscreen_element = 0.0 + } + } + if (!currentSection.fullscreenTimeline.length || time_to_first_fullscreen_element > 0.0) { + // here we should create a dummy curtain event + initial_curtain_event = makeFullscreenEvent(0, { + start_ts: currentSection.start_ts, + type: 'curtain', + settings: { + color: CURTAIN_COLOR_LOOKUP.white, // TODO: get this from the first annotation + fade_in_duration: '0.0', + fade_out_duration: '1.0', + duration: '0', + } + }) + // + console.log(initial_curtain_event) + currentSection.fullscreenTimeline.push(initial_curtain_event) + } currentSection.duration = currentSection.end_ts - currentSection.start_ts } -- cgit v1.2.3-70-g09d2