From 2761b9fa7d2456872727ca249cccc7c9d70cb82f Mon Sep 17 00:00:00 2001 From: anxuae Date: Wed, 21 Sep 2022 22:02:01 +0200 Subject: [PATCH] Protect on_previous/on_next if annimation --- README.rst | 2 +- pygame_imslider/slider.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3be06a3..e6cef6c 100755 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/pygame_imslider/slider.py b/pygame_imslider/slider.py index 25e12b4..0f85058 100755 --- a/pygame_imslider/slider.py +++ b/pygame_imslider/slider.py @@ -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) @@ -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)