From 74b18beed8651c4a7f6daa39102766676605cdc2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 26 Sep 2020 05:27:45 +0200 Subject: Change body scrolling to scroll only when the selected row hits the top/bottom --- include/Body.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/Body.hpp b/include/Body.hpp index 4987735..2f1644d 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -5,6 +5,9 @@ #include #include #include +#include +#include +#include "../external/RoundedRectangleShape.hpp" #include #include @@ -124,9 +127,12 @@ namespace QuickMedia { sf::Vector2i thumbnail_resize_target_size; sf::Vector2f thumbnail_fallback_size; sf::Color line_seperator_color; + private: + void draw_item(sf::RenderWindow &window, BodyItem *item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress); + float get_item_height(BodyItem *item); private: struct ThumbnailData { - bool referenced; + bool referenced = false; std::shared_ptr texture; bool loaded = false; }; @@ -135,5 +141,12 @@ namespace QuickMedia { std::unordered_map item_thumbnail_textures; bool loading_thumbnail; int selected_item; + int prev_selected_item; + float page_scroll; + // TODO: Use a loading gif or something similar instead, to properly indicate the image is loading. Which could also have text that says "failed to load image" when image loading failed. + sf::RectangleShape image_fallback; + sf::RectangleShape item_background_shadow; + sf::RoundedRectangleShape item_background; + sf::Sprite image; }; } \ No newline at end of file -- cgit v1.2.3