diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-11-09 18:00:50 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-11-09 18:00:50 +0100 |
| commit | 4439ed0edb8eba1fb728c5c264cdb62d468901f8 (patch) | |
| tree | 9960aea12e6554c701d4a7d046454b483ee28217 /animism-align/frontend/app/views/viewer/viewer.actions.js | |
| parent | 634abd7cec252e61dd171ffbbaa83dec87062bd1 (diff) | |
compare ends of timeline and use max point
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/viewer.actions.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 86c8d2d..4389f51 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -60,7 +60,13 @@ export const loadSections = () => dispatch => { let { paragraphs, footnotes } = buildParagraphs(sectionTextAnnotationOrder, currentSection.index, footnoteList.length) currentSection.paragraphs = paragraphs footnoteList = footnoteList.concat(footnotes) - currentSection.end_ts = currentSection.paragraphs[currentSection.paragraphs.length - 1].end_ts + // get the last end_ts in the episode + currentSection.end_ts = ( + currentSection.fullscreenTimeline.reduce( + (a,b) => Math.max(a, b.end_ts), + currentSection.paragraphs[currentSection.paragraphs.length - 1].end_ts, + ) + ) } // create a new section and reset state variables currentSection = newSection(annotation, sections.length, mediaIndex) @@ -151,8 +157,7 @@ export const loadSections = () => dispatch => { let time_to_first_fullscreen_element, initial_curtain_event // last fixes on the sections - for (let i = 0; i < sections.length; i++) { - currentSection = sections[i] + 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 @@ -184,11 +189,8 @@ export const loadSections = () => dispatch => { currentSection.fullscreenTimeline.unshift(initial_curtain_event) } currentSection.duration = currentSection.end_ts - currentSection.start_ts - } - - sections.forEach((section) => { - section.inlineParagraphCount = section.paragraphs.filter(p => !p.hidden).length - // console.log(i, section.inlineParagraphCount) + currentSection.inlineParagraphCount = currentSection.paragraphs.filter(p => !p.hidden).length + // console.log(i, currentSection.inlineParagraphCount) }) // console.log(sections) // console.log(footnoteList) |
