Skip to content

Commit

Permalink
Protect on_previous/on_next if annimation
Browse files Browse the repository at this point in the history
  • Loading branch information
anxuae committed Sep 21, 2022
1 parent 0244422 commit 2761b9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ override any of the following methods:
- **draw_arrow_state(surface, arrow)**: Draw arrow state.
- **draw_dot(surface, dot)**: Draw a dot.
- **draw_dot_state(surface, dot)**: Draw page-dot state
- **draw_slide_state(surface, slide)**: Draw slide state.
- **draw_slide(surface, slide)**: Draw a slide.
- **draw_slide_state(surface, slide)**: Draw slide state.
- **draw_background(surface)**: Draw background.

Getting/Setting data
Expand Down
6 changes: 6 additions & 0 deletions pygame_imslider/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ def update_pages(self):
def on_previous(self):
"""Go to previous slide.
"""
if self.layout.is_animated():
return # Let's finish the current animations

if self.stype == STYPE_LOOP or self.rewind:
# Loop, don't check limites
self.layout.set_selection(step=-self.per_move)
Expand All @@ -411,6 +414,9 @@ def on_previous(self):
def on_next(self):
"""Go to next slide.
"""
if self.layout.is_animated():
return # Let's finish the current animations

if self.stype == STYPE_LOOP or self.rewind:
# Loop, don't check limites
self.layout.set_selection(step=self.per_move)
Expand Down

0 comments on commit 2761b9f

Please sign in to comment.