From 04e2c665cc91efc8672c56ad5de197a00315623c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 9 Nov 2020 18:03:23 +0100 Subject: avoid over-extending sections --- animism-align/frontend/app/views/viewer/viewer.actions.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 4389f51..a29383b 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -159,8 +159,12 @@ export const loadSections = () => dispatch => { // last fixes on the sections sections.forEach((currentSection, i) => { // set the end_ts for each section (i.e. just before the next section starts) - if (currentSection.end_ts === 0 && i < sections.length - 1) { - currentSection.end_ts = sections[i+1].start_ts - 1 + if (i < sections.length - 1) { + // if the section doesnt have an end_ts (how??) then set it to end right before the next one. + // also if the end_ts is beyond the beginning of the next section (more possible...) + if (currentSection.end_ts === 0 || currentSection.end_ts > sections[i+1].start_ts - 1) { + 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 -- cgit v1.2.3-70-g09d2