From e68ff632e2f54c705ae1d69033e58a8f2d1ca00c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 16 Nov 2020 13:32:49 +0100 Subject: Matrix: show provisional messages as the message is being sent and received --- src/Body.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 2cf6f78..b456841 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -260,7 +260,7 @@ namespace QuickMedia { // TODO: Optimize by resizing |items| before insert void Body::insert_items_by_timestamps(BodyItems new_items) { for(auto &new_item : new_items) { - insert_item_by_timestamp(std::move(new_item)); + insert_item_by_timestamp(new_item); } } @@ -435,8 +435,8 @@ namespace QuickMedia { pos.y += page_scroll; - last_item_fully_visible = true; - items_cut_off = false; + bool last_item_fully_visible_set = false; + bool items_cut_off_set = false; sf::Vector2u window_size = window.getSize(); @@ -453,8 +453,10 @@ namespace QuickMedia { float item_height = get_item_height(item.get(), size.x); prev_pos.y -= (item_height + spacing_y); - if(prev_pos.y < start_y) + if(prev_pos.y < start_y) { items_cut_off = true; + items_cut_off_set = true; + } if(prev_pos.y + item_height + spacing_y <= start_y) break; @@ -480,6 +482,8 @@ namespace QuickMedia { if(after_pos.y - start_y >= size.y) { last_item_fully_visible = false; items_cut_off = true; + last_item_fully_visible_set = true; + items_cut_off_set = true; break; } @@ -497,6 +501,8 @@ namespace QuickMedia { if(after_pos.y - start_y > size.y) { last_item_fully_visible = false; items_cut_off = true; + last_item_fully_visible_set = true; + items_cut_off_set = true; } else { last_fully_visible_item = i; } @@ -507,6 +513,11 @@ namespace QuickMedia { offset_to_bottom = size.y - (after_pos.y - start_y); + if(!last_item_fully_visible_set) + last_item_fully_visible = true; + if(!items_cut_off_set) + items_cut_off = false; + for(auto it = item_thumbnail_textures.begin(); it != item_thumbnail_textures.end();) { if(!it->second->referenced) it = item_thumbnail_textures.erase(it); -- cgit v1.2.3