slidingView: Fix non-animated page changes
Add missing signal for ended animation and fix wrong index juggling.
This commit is contained in:
parent
6958f427bd
commit
23918bf31e
1 changed files with 12 additions and 3 deletions
|
|
@ -515,6 +515,10 @@ impl LpSlidingView {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn emit_target_page_reached(&self) {
|
||||||
|
self.emit_by_name::<()>("target-page-reached", &[]);
|
||||||
|
}
|
||||||
|
|
||||||
/// Removes all pages
|
/// Removes all pages
|
||||||
fn clear(&self, lazy: bool) {
|
fn clear(&self, lazy: bool) {
|
||||||
self.scroll_animation().pause();
|
self.scroll_animation().pause();
|
||||||
|
|
@ -557,8 +561,13 @@ impl LpSlidingView {
|
||||||
/// Move to specified page without animation
|
/// Move to specified page without animation
|
||||||
pub fn instant_to(&self, page: &LpImagePage) {
|
pub fn instant_to(&self, page: &LpImagePage) {
|
||||||
if let Some(index) = self.index_of(page) {
|
if let Some(index) = self.index_of(page) {
|
||||||
self.set_current_page(Some(page));
|
self.step_animation().pause();
|
||||||
|
self.scroll_animation().pause();
|
||||||
|
|
||||||
self.set_position(index as f64 - self.position_shift());
|
self.set_position(index as f64 - self.position_shift());
|
||||||
|
|
||||||
|
self.set_current_page(Some(page));
|
||||||
|
self.emit_target_page_reached();
|
||||||
} else {
|
} else {
|
||||||
log::error!("Page not in LpSlidingView {}", page.file().uri());
|
log::error!("Page not in LpSlidingView {}", page.file().uri());
|
||||||
}
|
}
|
||||||
|
|
@ -718,7 +727,7 @@ impl LpSlidingView {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
animation.connect_done(glib::clone!(@weak self as obj => move |_| {
|
animation.connect_done(glib::clone!(@weak self as obj => move |_| {
|
||||||
obj.emit_by_name("target-page-reached", &[])
|
obj.emit_target_page_reached()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
animation
|
animation
|
||||||
|
|
@ -751,7 +760,7 @@ impl LpSlidingView {
|
||||||
} else {
|
} else {
|
||||||
error!("No current page at end of animation");
|
error!("No current page at end of animation");
|
||||||
}
|
}
|
||||||
obj.emit_by_name("target-page-reached", &[])
|
obj.emit_target_page_reached();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
animation
|
animation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue