aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 10e31dd..45ca190 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -1050,6 +1050,8 @@ namespace QuickMedia {
prev_body_item = items[prev_index].get();
}
+ const float pos_y_before = pos.y;
+
const bool merge_with_previous = body_item_merge_handler && body_item_merge_handler(prev_body_item, item.get());
if(attach_side == AttachSide::TOP && merge_with_previous)
pos.y -= body_spacing[body_theme].spacing_y;
@@ -1124,10 +1126,25 @@ namespace QuickMedia {
if(attach_side == AttachSide::BOTTOM && merge_with_previous)
pos.y += body_spacing[body_theme].spacing_y;
+ const float pos_y_after = pos.y;
+ item->height = std::abs(pos_y_after - pos_y_before);
+ const float height_diff = item->height - item->prev_height;
+ item->prev_height = item->height;
+
if(attach_side == AttachSide::TOP) {
+ if(index < selected_item) {
+ page_scroll -= height_diff;
+ pos.y -= height_diff;
+ }
+
prev_body_item = item.get();
index = get_next_visible_item(index);
} else {
+ if(index > selected_item) {
+ page_scroll += height_diff;
+ pos.y += height_diff;
+ }
+
index = prev_index;
}
}