From fd4e8cdc9449dbb0224a1a41ef0561f50012d405 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 19 Oct 2020 03:12:31 +0200 Subject: Add pagination to ph and mangatown --- src/Body.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 9a811a9..fe57130 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -57,10 +57,8 @@ namespace QuickMedia { { progress_text.setFillColor(sf::Color::White); replies_text.setFillColor(sf::Color(129, 162, 190)); - thumbnail_resize_target_size.x = 200; - thumbnail_resize_target_size.y = 119; - thumbnail_fallback_size.x = 50.0f; - thumbnail_fallback_size.y = 100.0f; + thumbnail_resize_target_size.x = 120; + thumbnail_resize_target_size.y = 120; image_fallback.setFillColor(sf::Color::White); item_background.setFillColor(sf::Color(55, 60, 68)); } @@ -304,7 +302,11 @@ namespace QuickMedia { } // TODO: Optimize this, especially when scrolling to top/bottom. - // TODO: Test when wrapping is enabled + // TODO: If the thumbnail fallback size is larger than the real thumbnail size then the scroll will be incorrect when scrolling down + // because first we scroll by a larger value and then the thumbnail size changes when the thumbnail has finished loading + // and the selected item will no longer be exactly at the bottom of the window, and we will see parts of then next item. + // To fix this, we should detect when the selected item is at the bottom of the screen and the thumbnail changes from image fallback to the real thumbnail + // and add the difference in size to scroll, if the real thumbnail size is smaller than the image fallback. int selected_item_diff = selected_item - prev_selected_item; int selected_int_diff_abs = std::abs(selected_item_diff); if(selected_item_diff > 0) { @@ -378,8 +380,8 @@ namespace QuickMedia { if(after_pos.y - start_y >= size.y) break; - float item_height = get_item_height(item.get()); update_dirty_state(item.get(), size); + float item_height = get_item_height(item.get()); item->last_drawn_time = elapsed_time; // This is needed here rather than above the loop, since update_dirty_text cant be called inside scissor because it corrupts the text for some reason -- cgit v1.2.3