Skip to content

Commit 58999d0

Browse files
authored
fix(cli): previous presentation starts last slide (#14)
This changes the previous behavior that was such that going to previous presentation (scene) would start it from zero.
1 parent 8696fca commit 58999d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

manim_slides/present.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ def reset(self):
7373
self.current_slide_i = 0
7474
self.slides[-1]["terminated"] = False
7575

76+
def start_last_slide(self):
77+
self.current_animation = self.slides[-1]["start_animation"]
78+
self.load_this_cap(self.current_animation)
79+
self.current_slide_i = len(self.slides[-1])
80+
self.slides[-1]["terminated"] = False
81+
7682
def next(self):
7783
if self.current_slide["type"] == "last":
7884
self.current_slide["terminated"] = True
@@ -312,7 +318,7 @@ def handle_key(self):
312318
elif self.config.BACK.match(key):
313319
if self.current_presentation.current_slide_i == 0:
314320
self.current_presentation_i = max(0, self.current_presentation_i - 1)
315-
self.current_presentation.reset()
321+
self.current_presentation.start_last_slide()
316322
self.state = State.PLAYING
317323
else:
318324
self.current_presentation.prev()

0 commit comments

Comments
 (0)