diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-11-09 18:03:23 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-11-09 18:03:23 +0100 |
| commit | 04e2c665cc91efc8672c56ad5de197a00315623c (patch) | |
| tree | c9020db2e2e43f5bef4f7af51be31b19f72a8058 | |
| parent | 4439ed0edb8eba1fb728c5c264cdb62d468901f8 (diff) | |
avoid over-extending sections
| -rw-r--r-- | animism-align/frontend/app/views/viewer/viewer.actions.js | 8 |
1 files 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 |
