From 24335ceccbf81e9a1bf49c1a2878c8ee31c63b69 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 18 Aug 2021 20:37:48 +0200 Subject: Show line at top/bottom when there are items above/below that are not visible --- src/QuickMedia.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 6be7dab..050ae01 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -59,6 +59,7 @@ static int FPS_IDLE; static const double IDLE_TIMEOUT_SEC = 2.0; static const sf::Vector2i AVATAR_THUMBNAIL_SIZE(std::floor(32), std::floor(32)); +static const float more_items_height = 2.0f; static const std::pair valid_plugins[] = { std::make_pair("launcher", nullptr), @@ -1988,6 +1989,12 @@ namespace QuickMedia { } } + sf::RectangleShape more_items_above_rect; + more_items_above_rect.setFillColor(get_current_theme().more_items_color); + + sf::RectangleShape more_items_below_rect; + more_items_below_rect.setFillColor(get_current_theme().more_items_color); + sf::Event event; sf::Clock frame_timer; @@ -2093,6 +2100,12 @@ namespace QuickMedia { gradient_points[3].position.x = 0.0f; gradient_points[3].position.y = body_pos.y + gradient_height; } + + more_items_above_rect.setPosition(sf::Vector2f(0.0f, body_pos.y)); + more_items_above_rect.setSize(sf::Vector2f(window_size.x, more_items_height)); + + more_items_below_rect.setPosition(sf::Vector2f(0.0f, window_size.y - more_items_height)); + more_items_below_rect.setSize(sf::Vector2f(window_size.y, more_items_height)); } if(tab_associated_data[selected_tab].fetching_next_page_running) { @@ -2265,16 +2278,23 @@ namespace QuickMedia { window.clear(get_current_theme().background_color); page_loop_render(window, tabs, selected_tab, tab_associated_data[selected_tab], json_chapters, ui_tabs); - AsyncImageLoader::get_instance().update(); - window.display(); if(tabs[selected_tab].body->get_num_items() > 0) { if(tabs[selected_tab].body->attach_side == AttachSide::TOP && !tabs[selected_tab].body->is_bottom_cut_off()) on_reached_end(); else if(tabs[selected_tab].body->attach_side == AttachSide::BOTTOM && !tabs[selected_tab].body->is_top_cut_off()) on_reached_end(); + + if(tabs[selected_tab].body->is_top_cut_off()) + window.draw(more_items_above_rect); + + if(tabs[selected_tab].body->is_bottom_cut_off()) + window.draw(more_items_below_rect); } + AsyncImageLoader::get_instance().update(); + window.display(); + if(go_to_previous_page) { go_to_previous_page = false; return true; @@ -3862,6 +3882,12 @@ namespace QuickMedia { const float chat_input_padding_x = std::floor(10.0f * get_ui_scale()); const float chat_input_padding_y = std::floor(10.0f * get_ui_scale()); + sf::RectangleShape more_items_above_rect; + more_items_above_rect.setFillColor(get_current_theme().more_items_color); + + sf::RectangleShape more_items_below_rect; + more_items_below_rect.setFillColor(get_current_theme().more_items_color); + sf::Vector2f body_pos; sf::Vector2f body_size; sf::Event event; @@ -4229,6 +4255,12 @@ namespace QuickMedia { logo_sprite.setPosition(logo_padding_x, chat_input_padding_y); file_to_upload_sprite.setPosition(logo_sprite.getPosition() + sf::Vector2f(0.0f, logo_size.y + logo_file_to_upload_spacing)); + + more_items_above_rect.setPosition(sf::Vector2f(0.0f, body_pos.y)); + more_items_above_rect.setSize(sf::Vector2f(window_size.x, more_items_height)); + + more_items_below_rect.setPosition(sf::Vector2f(0.0f, window_size.y - more_items_height)); + more_items_below_rect.setSize(sf::Vector2f(window_size.y, more_items_height)); } //comment_input.update(); @@ -4367,6 +4399,14 @@ namespace QuickMedia { } } + if(navigation_stage == NavigationStage::REPLYING || navigation_stage == NavigationStage::VIEWING_COMMENTS) { + if(thread_body->is_top_cut_off()) + window.draw(more_items_above_rect); + + if(thread_body->is_bottom_cut_off()) + window.draw(more_items_below_rect); + } + AsyncImageLoader::get_instance().update(); window.display(); } -- cgit v1.2.3