From b83e18c475fa68806accf5d5b23aafcc2234e5dc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 12 Jun 2021 03:47:37 +0200 Subject: Better drop shadow --- src/Body.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 76ad110..b3ec7e1 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -1486,13 +1486,14 @@ namespace QuickMedia { } float Body::get_item_height(BodyItem *item, float width, bool load_texture, bool include_embedded_item, bool merge_with_previous, int item_index) { + const bool rendering_card_view = card_view && card_view_enabled; sf::Vector2i content_size = get_item_thumbnail_size(item); float image_height = 0.0f; float text_offset_x = body_spacing[body_theme].padding_x; if(draw_thumbnails && load_texture && !item->thumbnail_url.empty() && !merge_with_previous) { std::shared_ptr item_thumbnail = AsyncImageLoader::get_instance().get_thumbnail(item->thumbnail_url, item->thumbnail_is_local, content_size); - content_size = clamp_to_size_x(content_size, sf::Vector2i(width - body_spacing[body_theme].image_padding_x * 2.0f, content_size.y)); + content_size = clamp_to_size_x(content_size, sf::Vector2i(width - (rendering_card_view ? 0.0f : body_spacing[body_theme].image_padding_x * 2.0f), content_size.y)); image_height = content_size.y; if(item_thumbnail && item_thumbnail->loading_state == LoadingState::FINISHED_LOADING && item_thumbnail->image->getSize().x > 0 && item_thumbnail->image->getSize().y > 0) { @@ -1526,7 +1527,7 @@ namespace QuickMedia { // image_height = content_size.y; } - const float text_max_width = (card_view && card_view_enabled) ? width : (width - text_offset_x - body_spacing[body_theme].image_padding_x); + const float text_max_width = rendering_card_view ? width : (width - text_offset_x - body_spacing[body_theme].image_padding_x); if(load_texture) update_dirty_state(item, text_max_width); @@ -1578,7 +1579,7 @@ namespace QuickMedia { else item_height = item->loaded_content_height; - if(card_view && card_view_enabled) { + if(rendering_card_view) { item_height += item->loaded_image_height; } else { const bool has_thumbnail = draw_thumbnails && !item->thumbnail_url.empty() && !merge_with_previous; -- cgit v1.2.3