imageView: Reset zoom and rotation on page change
Keeping zoom or rotation would be inconsistent since it's only preserved while images are cached. Close #65
This commit is contained in:
parent
9c51dea6d1
commit
70d8d00a3d
1 changed files with 16 additions and 1 deletions
|
|
@ -473,14 +473,29 @@ impl LpImageView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[template_callback]
|
#[template_callback]
|
||||||
|
/// Called when page change animation completed
|
||||||
fn target_page_reached_cb(&self) {
|
fn target_page_reached_cb(&self) {
|
||||||
|
let current_page = self.current_page();
|
||||||
|
|
||||||
if self.imp().preserve_content.get() {
|
if self.imp().preserve_content.get() {
|
||||||
if let Some(new_page) = self.current_page() {
|
if let Some(new_page) = ¤t_page {
|
||||||
self.update_sliding_view(&new_page.path());
|
self.update_sliding_view(&new_page.path());
|
||||||
} else {
|
} else {
|
||||||
log::error!("No LpImagePage");
|
log::error!("No LpImagePage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset zoom and rotation of other pages
|
||||||
|
if let Some(new_page) = ¤t_page {
|
||||||
|
let mut other_pages = self.sliding_view().pages();
|
||||||
|
other_pages.remove(&new_page.path());
|
||||||
|
for (_, page) in other_pages {
|
||||||
|
let image = page.image();
|
||||||
|
image.set_rotation(0.);
|
||||||
|
image.set_best_fit(true);
|
||||||
|
image.zoom_best_fit();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[template_callback]
|
#[template_callback]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue