From d52f89bc8ab581ded9cbcecc921a355ab9638a55 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 29 May 2021 20:30:23 +0200 Subject: Scroll fix when getting new messages in matrix, or something --- src/Body.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 42a3b35..076d093 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -600,8 +600,6 @@ namespace QuickMedia { if(pos.y + selected_scrolled > 0.0f) selected_scrolled = 0.0f; - else - pos.y += selected_scrolled; } else { if(page_scroll < 0.0) page_scroll = 0.0; @@ -611,8 +609,6 @@ namespace QuickMedia { if(pos.y + selected_scrolled < body_size.y) selected_scrolled = 0.0f; - else - pos.y += selected_scrolled; } pos.y += selected_scrolled; @@ -749,12 +745,12 @@ namespace QuickMedia { if(is_touch_enabled()) return; - const float item_target_top_diff = item_background_target_pos_y; - const float item_target_bottom_diff = (item_background_target_pos_y + item_background_target_height + spacing_y) - body_size.y; - if(((body_size_changed && attach_side == AttachSide::BOTTOM) || selected_item_diff < 0) && item_target_top_diff < 0.0f) { + const float item_target_top_diff = item_background_target_pos_y - selected_scrolled; + const float item_target_bottom_diff = (item_background_target_pos_y - selected_scrolled + item_background_target_height + spacing_y) - body_size.y; + if(item_target_top_diff < 0.0f || !selected_item_fits_in_body) { //extra_scroll_target -= item_target_top_diff; stuck_direction = StuckDirection::TOP; - } else if(((body_size_changed && attach_side == AttachSide::TOP) || selected_item_diff > 0) && item_target_bottom_diff > 0.0) { + } else if(item_target_bottom_diff > 0.0) { //extra_scroll_target -= item_target_bottom_diff; stuck_direction = StuckDirection::BOTTOM; } -- cgit v1.2.3