diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 3c210a8..76ad110 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -546,7 +546,7 @@ namespace QuickMedia { const bool rendering_card_view = card_view && card_view_enabled; - const bool body_size_changed = std::abs(size.x - body_size.x) > 0.1f || std::abs(size.y - body_size.y) > 0.1f; + body_size_changed = std::abs(size.x - body_size.x) > 0.1f || std::abs(size.y - body_size.y) > 0.1f; if(body_size_changed) body_size = size; @@ -1297,7 +1297,7 @@ namespace QuickMedia { if(draw_thumbnails && !merge_with_previous && !item->thumbnail_url.empty()) item_thumbnail = AsyncImageLoader::get_instance().get_thumbnail(item->thumbnail_url, item->thumbnail_is_local, thumbnail_size); - thumbnail_size = clamp_to_size_x(thumbnail_size, sf::Vector2i(size.x, thumbnail_size.y)); + thumbnail_size = clamp_to_size_x(thumbnail_size, sf::Vector2i(size.x - body_spacing[body_theme].image_padding_x * 2.0f, thumbnail_size.y)); if(body_item_render_callback && include_embedded_item) body_item_render_callback(item); @@ -1492,7 +1492,7 @@ namespace QuickMedia { 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<ThumbnailData> 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, content_size.y)); + content_size = clamp_to_size_x(content_size, sf::Vector2i(width - 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) { @@ -1515,7 +1515,10 @@ namespace QuickMedia { } // TODO: This wont work if the image has changed to a different image (for example if the image is a local image and it has been overwritten). - item->loaded_image_height = std::max(item->loaded_image_height, image_height); + if(body_size_changed) + item->loaded_image_height = image_height; + else + item->loaded_image_height = std::max(item->loaded_image_height, image_height); } else if(item->thumbnail_size.x > 0) { text_offset_x += body_spacing[body_theme].image_padding_x + content_size.x; // TODO: Fix. This makes the body item have incorrect position when loading and if the item is merge_with_previous? and has an embedded item |