diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-29 20:30:23 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-29 20:30:23 +0200 |
commit | d52f89bc8ab581ded9cbcecc921a355ab9638a55 (patch) | |
tree | 6bf539be481abab99a9147c55d7be4e2ccdece95 /src | |
parent | 11cc8e1209e99d394febfde0696b94dd69972e4a (diff) |
Scroll fix when getting new messages in matrix, or something
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
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; } |