Compare commits

...

2 Commits

Author SHA1 Message Date
f7b9036063 Apply cargo hint 2024-02-01 18:31:30 +01:00
c6c07e788b Improve caching order and priority cache on fullscreen 2024-02-01 18:29:49 +01:00
2 changed files with 11 additions and 4 deletions

View File

@ -214,7 +214,7 @@ impl SyncCacheCommandChannel {
} }
impl SyncCacheCommandSender { impl SyncCacheCommandSender {
pub fn is_channel_open(&self) -> bool { pub fn _is_channel_open(&self) -> bool {
Rc::strong_count(&self.channel) > 1 Rc::strong_count(&self.channel) > 1
} }

View File

@ -56,6 +56,10 @@ impl DocumentCanvas {
} }
pub fn cache_initial_pages(&self, area_height: i32) { pub fn cache_initial_pages(&self, area_height: i32) {
self.priority_cache_current_pages(area_height);
}
pub fn priority_cache_current_pages(&self, area_height: i32){
self.page_cache_sender.send_priority_cache_commands( self.page_cache_sender.send_priority_cache_commands(
&[self.current_page_number, self.current_page_number + 1], &[self.current_page_number, self.current_page_number + 1],
area_height, area_height,
@ -65,11 +69,11 @@ impl DocumentCanvas {
pub fn cache_surrounding_pages(&self, area_height: i32) { pub fn cache_surrounding_pages(&self, area_height: i32) {
self.page_cache_sender.send_cache_commands( self.page_cache_sender.send_cache_commands(
&[ &[
self.current_page_number.saturating_sub(2),
self.current_page_number.saturating_sub(1),
self.current_page_number, self.current_page_number,
self.current_page_number + 1, self.current_page_number + 1,
self.current_page_number.saturating_sub(1),
self.current_page_number + 2, self.current_page_number + 2,
self.current_page_number.saturating_sub(2),
self.current_page_number + 3, self.current_page_number + 3,
], ],
area_height, area_height,
@ -106,10 +110,13 @@ pub fn toggle_fullscreen(ui: &Ui) {
ui.header_bar.hide(); ui.header_bar.hide();
ui.bottom_bar.hide(); ui.bottom_bar.hide();
ui.window.fullscreen(); ui.window.fullscreen();
let new_area_height = ui.image_container.height() + ui.header_bar.height();
ui.document_canvas.as_ref().unwrap().priority_cache_current_pages(new_area_height);
ui.document_canvas ui.document_canvas
.as_ref() .as_ref()
.unwrap() .unwrap()
.cache_surrounding_pages(ui.image_container.height() + ui.header_bar.height()); .cache_surrounding_pages(new_area_height);
} }
false => { false => {
ui.header_bar.show(); ui.header_bar.show();