aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-11 01:21:12 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-11 01:21:12 +0100
commit224a38f931e24ffad8c99c5b02fd8939783de852 (patch)
tree44824be0799756a55ec4cea9f2b91b38bbff8aa4
parenta3eb2a9d6315f8a953f7dee72ebe4d17a4b9d42e (diff)
Fix image viewer scrolling to bottom if some pages are larger than window size
-rw-r--r--TODO3
-rw-r--r--src/ImageViewer.cpp11
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);