aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--external/RoundedRectangleShape.cpp7
-rw-r--r--include/Body.hpp3
-rw-r--r--src/QuickMedia.cpp13
4 files changed, 20 insertions, 7 deletions
diff --git a/TODO b/TODO
index 679ed4d..0da0892 100644
--- a/TODO
+++ b/TODO
@@ -28,4 +28,6 @@ Speed up thumbnail creating (image resizing).
Extract thumbnail from images that are being downloaded, while its downloading and show that while the full image is downloading (upscaled, or with blurhash).
Use one special thread to load cached files. Right now if there are multiple images on the screen and 1 needs to download while the others are cached, then the cached images wont load until that 1 image has downloaded.
Press pgup/pgdown to scroll and entire page.
-Press home/end to scroll to top/bottom. \ No newline at end of file
+Press home/end to scroll to top/bottom.
+Scrolling past page causes the page to jump up and down very fast because the new thumbnail is loaded. Fix this somehow. In youtube this can be fixed by setting the thumbnail image fallback size to the same size and thumbnail images, but that doesn't work for matrix with different image sizes!
+Find a way to decrease cpu usage when scrolling fast. Right now sf::Texture::load will use up to 10% cpu on my machine. \ No newline at end of file
diff --git a/external/RoundedRectangleShape.cpp b/external/RoundedRectangleShape.cpp
index 3dc3274..e56cf9f 100644
--- a/external/RoundedRectangleShape.cpp
+++ b/external/RoundedRectangleShape.cpp
@@ -39,8 +39,11 @@ RoundedRectangleShape::RoundedRectangleShape(const Vector2f& size, float radius,
////////////////////////////////////////////////////////////
void RoundedRectangleShape::setSize(const Vector2f& size)
{
- mySize = size;
- update();
+ // Modified by dec05eba
+ if(std::abs(size.x - mySize.x) > 1.0f || std::abs(size.y - mySize.y) > 1.0f) {
+ mySize = size;
+ update();
+ }
}
////////////////////////////////////////////////////////////
diff --git a/include/Body.hpp b/include/Body.hpp
index 2f1644d..008aa70 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -114,6 +114,9 @@ namespace QuickMedia {
int get_selected_item() const { return selected_item; }
+ void set_page_scroll(float scroll) { page_scroll = scroll; }
+ float get_page_scroll() const { return page_scroll; }
+
sf::Font *font;
sf::Font *bold_font;
sf::Font *cjk_font;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 74ee75e..2e1eac3 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2824,6 +2824,7 @@ namespace QuickMedia {
sf::Event event;
std::stack<int> comment_navigation_stack;
+ std::stack<int> comment_page_scroll_stack;
while (current_page == Page::IMAGE_BOARD_THREAD) {
while (window.pollEvent(event)) {
@@ -2898,17 +2899,19 @@ namespace QuickMedia {
body->items[reply_index]->visible = true;
}
comment_navigation_stack.push(body->get_selected_item());
+ comment_page_scroll_stack.push(body->get_page_scroll());
+ body->clamp_selection();
} else if(event.key.code == sf::Keyboard::BackSpace && !comment_navigation_stack.empty()) {
- size_t previous_selected = 0;
- if(!comment_navigation_stack.empty()) {
- previous_selected = comment_navigation_stack.top();
- }
+ size_t previous_selected = comment_navigation_stack.top();
+ float previous_page_scroll = comment_page_scroll_stack.top();
comment_navigation_stack.pop();
+ comment_page_scroll_stack.pop();
if(comment_navigation_stack.empty()) {
for(auto &body_item : body->items) {
body_item->visible = true;
}
body->set_selected_item(previous_selected);
+ body->clamp_selection();
} else {
for(auto &body_item : body->items) {
body_item->visible = false;
@@ -2919,7 +2922,9 @@ namespace QuickMedia {
for(size_t reply_index : selected_item->replies) {
body->items[reply_index]->visible = true;
}
+ body->clamp_selection();
}
+ body->set_page_scroll(previous_page_scroll);
} else if(event.key.code == sf::Keyboard::C && event.key.control && selected_item) {
navigation_stage = NavigationStage::REPLYING;
} else if(event.key.code == sf::Keyboard::R && selected_item) {