From 08cef1dc766830825f9f25591fb70d0b360d6304 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 11 Apr 2022 05:27:10 +0200 Subject: Use correct reaction region size --- src/Body.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 1451541..f9eb021 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -1442,7 +1442,8 @@ namespace QuickMedia { text_offset_x += body_spacing[body_theme].image_padding_x + item->loaded_image_size.x; } - const float text_max_width = size.x - text_offset_x; + const float image_padding_x = !draw_thumbnails ? 0.0f : body_spacing[body_theme].image_padding_x; + const float text_max_width = size.x - text_offset_x - image_padding_x; const float text_offset_y = std::floor(6.0f * get_config().scale * get_config().font_scale); const float timestamp_text_y = std::floor(item_pos.y + padding_y - text_offset_y - std::floor(4.0f * get_config().scale * get_config().font_scale)); @@ -1500,8 +1501,8 @@ namespace QuickMedia { reaction_max_height = std::max(reaction_max_height, reaction.size.y); reaction_background.set_size(mgl::vec2f(reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f, reaction.size.y + body_spacing[body_theme].reaction_background_padding_y * 2.0f)); - const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x; - if(i != 0 && (text_offset_x + new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) { + const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f; + if(i != 0 && (new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) { reaction_offset_x = 0.0f; item_pos.y += reaction_max_height_prev + body_spacing[body_theme].reaction_padding_y + text_offset_y; reaction_max_height = reaction.size.y; @@ -1509,7 +1510,7 @@ namespace QuickMedia { reaction_offset_x = reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x; } else { reaction_background.set_position(vec2f_floor(item_pos.x + text_offset_x + reaction_offset_x, item_pos.y + padding_y)); - reaction_offset_x = new_reaction_offset_x; + reaction_offset_x = new_reaction_offset_x + body_spacing[body_theme].reaction_spacing_x; } if(reaction.text) { @@ -1735,13 +1736,13 @@ namespace QuickMedia { const float reaction_max_height_prev = reaction_max_height; reaction_max_height = std::max(reaction_max_height, reaction.size.y); - const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x; - if(i != 0 && (text_offset_x + new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) { + const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f; + if(i != 0 && (new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) { item_height += reaction_max_height_prev + body_spacing[body_theme].reaction_padding_y + std::floor(6.0f * get_config().scale); reaction_max_height = reaction.size.y; reaction_offset_x = reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x; } else { - reaction_offset_x = new_reaction_offset_x; + reaction_offset_x = new_reaction_offset_x + body_spacing[body_theme].reaction_spacing_x; } } item_height += reaction_max_height + body_spacing[body_theme].reaction_padding_y; -- cgit v1.2.3