Skip to content

Commit 594df2f

Browse files
committed
fix: use subsection start_time and add tail section in HTML converter
Unified HTML subsection timing with PowerPoint approach: - Use subsection.start_time instead of always starting from 0.0 - Add tail section for content after last subsection - Matches Qt presenter and PowerPoint behavior This fixes timing issues in HTML where subsections were always showing accumulated content from the beginning instead of just the subsection's time range.
1 parent 244ca7b commit 594df2f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

manim_slides/convert.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ def _iter_slide_sections(self, slide_config: SlideConfig) -> list[dict[str, Any]
587587
]
588588

589589
sections = []
590+
last_end = 0.0
590591
for subsection in slide_config.subsections:
591592
sections.append(
592593
{
@@ -596,10 +597,24 @@ def _iter_slide_sections(self, slide_config: SlideConfig) -> list[dict[str, Any]
596597
"notes": f"{slide_config.notes}\n\n{subsection.name}"
597598
if slide_config.notes and subsection.name
598599
else subsection.name or slide_config.notes,
599-
"start_time": 0.0, # Always start from beginning to show accumulated content
600+
"start_time": subsection.start_time,
600601
"end_time": subsection.end_time,
601602
}
602603
)
604+
last_end = subsection.end_time
605+
606+
video_duration = get_duration_seconds(slide_config.file)
607+
if video_duration - last_end > 1e-3:
608+
sections.append(
609+
{
610+
"file": slide_config.file,
611+
"loop": slide_config.loop,
612+
"auto_next": False,
613+
"notes": slide_config.notes,
614+
"start_time": last_end,
615+
"end_time": video_duration,
616+
}
617+
)
603618
return sections
604619

605620
def convert_to(self, dest: Path) -> None: # noqa: C901

0 commit comments

Comments
 (0)