[gnome-tour/wip/exalm/ui-cleanups: 2/3] paginator: Switch page in the middle of the transition and not at the end



commit 9d3358874481512b654d3ad558b4d80cb53aff8c
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Jul 14 01:59:35 2020 +0500

    paginator: Switch page in the middle of the transition and not at the end
    
    Take the position and round it, make the transition a bit more responsive.

 src/widgets/paginator.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/widgets/paginator.rs b/src/widgets/paginator.rs
index a85fd8f..8209ebc 100644
--- a/src/widgets/paginator.rs
+++ b/src/widgets/paginator.rs
@@ -69,13 +69,12 @@ impl PaginatorWidget {
 
             p.close_btn.set_opacity(opacity);
             p.close_btn.set_visible(opacity > 0_f64);
-        }));
 
-        self.carousel.connect_page_changed(clone!(@weak p => move |_carousel, page_nr| {
+            let page_nr = position.round() as u32;
             let pages = &p.pages.borrow();
             let page = pages.get(page_nr as usize).unwrap();
-            p.headerbar.set_title(Some(&page.get_title()));
 
+            p.headerbar.set_title(Some(&page.get_title()));
             p.current_page.replace(page_nr);
         }));
 


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