diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-11 01:21:12 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-11 01:21:12 +0100 |
commit | 224a38f931e24ffad8c99c5b02fd8939783de852 (patch) | |
tree | 44824be0799756a55ec4cea9f2b91b38bbff8aa4 | |
parent | a3eb2a9d6315f8a953f7dee72ebe4d17a4b9d42e (diff) |
Fix image viewer scrolling to bottom if some pages are larger than window size
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | src/ImageViewer.cpp | 11 |
2 files changed, 9 insertions, 5 deletions
@@ -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); |