From 224a38f931e24ffad8c99c5b02fd8939783de852 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Feb 2022 01:21:12 +0100 Subject: Fix image viewer scrolling to bottom if some pages are larger than window size --- TODO | 3 ++- src/ImageViewer.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index a74fa5d..0d3d941 100644 --- a/TODO +++ b/TODO @@ -215,4 +215,5 @@ Use reference for text.get_string() in all places. Cleanup font sizes that are not visible (or not used for a while). Also do the same for character ranges font texture. Show video upload date in video description on youtube. Add latest read chapter name to manga progress, to easily see from manga list page how we have progressed in the manga. -Allow changing manga sorting in gui (especially for local manga). \ No newline at end of file +Allow changing manga sorting in gui (especially for local manga). +Allow using ~ and $HOME in config file. \ No newline at end of file diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp index fcc3b3b..c18ba92 100644 --- a/src/ImageViewer.cpp +++ b/src/ImageViewer.cpp @@ -207,10 +207,13 @@ namespace QuickMedia { window_size.y = window_size_i.y; window_size_set = true; - for(int i = 0; i < current_page; ++i) { - const mgl::vec2d size = get_page_size(i); - scroll -= size.y; - page_size[i].prev_size = size; + for(int i = 0; i < num_pages; ++i) { + const mgl::vec2d current_page_size = get_page_size(i); + const double scroll_diff = current_page_size.y - page_size[i].prev_size.y; + page_size[i].prev_size = current_page_size; + + if(i < current_page) + scroll -= scroll_diff; } scroll -= (get_page_size(current_page).y * 0.5 - window_size.y * 0.5); -- cgit v1.2.3