diff options
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) |
