Fix initial pages being not rendered in max res
This commit is contained in:
parent
1a7f7498cd
commit
9240db298d
@ -253,6 +253,9 @@ where
|
|||||||
// Besides the name, it is not in another thread
|
// Besides the name, it is not in another thread
|
||||||
glib::spawn_future_local(async move {
|
glib::spawn_future_local(async move {
|
||||||
while command_receiver.is_channel_open() {
|
while command_receiver.is_channel_open() {
|
||||||
|
// Add delay to tell gtk to give rendering priority
|
||||||
|
timeout_future(Duration::from_millis(1)).await;
|
||||||
|
|
||||||
if let Some(command) = command_receiver.receive_most_important_command() {
|
if let Some(command) = command_receiver.receive_most_important_command() {
|
||||||
if let Some(response) = cache.process_command(command).unwrap_or_else(|e| {
|
if let Some(response) = cache.process_command(command).unwrap_or_else(|e| {
|
||||||
error!("Error processing command: {}", e);
|
error!("Error processing command: {}", e);
|
||||||
@ -264,9 +267,6 @@ where
|
|||||||
debug!("receiver done");
|
debug!("receiver done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add delay to tell gtk to give rendering priority
|
|
||||||
timeout_future(Duration::from_millis(1)).await;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ pub fn load_document(file: impl AsRef<Path>, ui: Rc<RefCell<Ui>>) {
|
|||||||
cache::CacheResponse::SinglePageRetrieved { page } => {
|
cache::CacheResponse::SinglePageRetrieved { page } => {
|
||||||
ui.borrow_mut().image_left.set_paintable(Some(page.as_ref()));
|
ui.borrow_mut().image_left.set_paintable(Some(page.as_ref()));
|
||||||
ui.borrow_mut().image_right.set_visible(false);
|
ui.borrow_mut().image_right.set_visible(false);
|
||||||
let area_height = ui.borrow().image_left.height();
|
let area_height = ui.borrow().image_container.height();
|
||||||
ui.borrow().document_canvas.as_ref().unwrap().cache_surrounding_pages(area_height);
|
ui.borrow().document_canvas.as_ref().unwrap().cache_surrounding_pages(area_height);
|
||||||
}
|
}
|
||||||
cache::CacheResponse::TwoPagesRetrieved {
|
cache::CacheResponse::TwoPagesRetrieved {
|
||||||
@ -304,7 +304,7 @@ pub fn load_document(file: impl AsRef<Path>, ui: Rc<RefCell<Ui>>) {
|
|||||||
ui.borrow_mut().image_left.set_paintable(Some(page_left.as_ref()));
|
ui.borrow_mut().image_left.set_paintable(Some(page_left.as_ref()));
|
||||||
ui.borrow_mut().image_right.set_paintable(Some(page_right.as_ref()));
|
ui.borrow_mut().image_right.set_paintable(Some(page_right.as_ref()));
|
||||||
ui.borrow_mut().image_right.set_visible(true);
|
ui.borrow_mut().image_right.set_visible(true);
|
||||||
let area_height = ui.borrow().image_left.height();
|
let area_height = ui.borrow().image_container.height();
|
||||||
ui.borrow().document_canvas.as_ref().unwrap().cache_surrounding_pages(area_height);
|
ui.borrow().document_canvas.as_ref().unwrap().cache_surrounding_pages(area_height);
|
||||||
},
|
},
|
||||||
cache::CacheResponse::PageResolutionUpgraded { page_number, page } => {
|
cache::CacheResponse::PageResolutionUpgraded { page_number, page } => {
|
||||||
@ -319,7 +319,7 @@ pub fn load_document(file: impl AsRef<Path>, ui: Rc<RefCell<Ui>>) {
|
|||||||
|
|
||||||
let mut document_canvas = DocumentCanvas::new(sender);
|
let mut document_canvas = DocumentCanvas::new(sender);
|
||||||
document_canvas.num_pages = Some(num_pages);
|
document_canvas.num_pages = Some(num_pages);
|
||||||
document_canvas.cache_initial_pages(ui.borrow().image_left.height());
|
document_canvas.cache_initial_pages(ui.borrow().image_container.height());
|
||||||
|
|
||||||
ui.borrow_mut().document_canvas = Some(document_canvas);
|
ui.borrow_mut().document_canvas = Some(document_canvas);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user