diff options
-rw-r--r-- | src/Body.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 75bf092..c2a7681 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -586,10 +586,17 @@ namespace QuickMedia { selected_line_bottom_visible |= selected_item_fits_on_screen; if(keep_selected_inside_body) { - if(attach_side == AttachSide::TOP && std::abs(offset_to_top) > 0.1f) - page_scroll -= offset_to_top; - else if(attach_side == AttachSide::BOTTOM && std::abs(offset_to_bottom) > 0.1f) - page_scroll += offset_to_bottom; + if(!first_item_fully_visible && !last_item_fully_visible) { + if(offset_to_top > 0.0f) + page_scroll -= offset_to_top; + else if(offset_to_bottom > 0.0f) + page_scroll += offset_to_bottom; + } else { + if(attach_side == AttachSide::TOP) + page_scroll -= offset_to_top; + else if(attach_side == AttachSide::BOTTOM) + page_scroll += offset_to_bottom; + } if(page_scroll > size.y - selected_item_height && selected_item_fits_on_screen) { //fprintf(stderr, "top: %f\n", page_scroll - (size.y - selected_item_height)); |