[gnome-software: 2/3] gs-featured-carousel: Skip animations when going from 1st to last page




commit 9c0ba6877c5f2823232acf00639205bd019b3852
Author: Sebastian Keller <skeller gnome org>
Date:   Tue Mar 30 00:18:05 2021 +0200

    gs-featured-carousel: Skip animations when going from 1st to last page
    
    This is already done when going from the last page to the first page to
    avoid rapidly spooling through pages. This commit now adds the same for
    going from the first to the last page using the back button.

 src/gs-featured-carousel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-featured-carousel.c b/src/gs-featured-carousel.c
index b47a77d97..f1de11e83 100644
--- a/src/gs-featured-carousel.c
+++ b/src/gs-featured-carousel.c
@@ -87,10 +87,10 @@ show_relative_page (GsFeaturedCarousel *self,
        new_page_widget = g_list_nth_data (children, new_page);
        g_assert (new_page_widget != NULL);
 
-       /* Don’t animate if we’re wrapping from the last page back to the first,
-        * as it means rapidly spooling through all the pages, which looks
-        * confusing. */
-       if (new_page == 0.0 && delta > 0)
+       /* Don’t animate if we’re wrapping from the last page back to the first
+     * or from the first page to the last going backwards as it means rapidly
+     * spooling through all the pages, which looks confusing. */
+       if ((new_page == 0.0 && delta > 0) || (new_page == n_pages - 1 && delta < 0))
                animation_duration_ms = 0;
 
        hdy_carousel_scroll_to_full (self->carousel, new_page_widget, animation_duration_ms);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]