aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index dae0ca2..534f2b5 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -368,6 +368,12 @@ namespace QuickMedia {
return items[last_fully_visible_item].get();
}
+ BodyItem* Body::get_last_visible_item() {
+ if(last_visible_item < 0 || last_visible_item >= (int)items.size() || !items[last_visible_item]->visible)
+ return nullptr;
+ return items[last_visible_item].get();
+ }
+
void Body::clamp_selection() {
int num_items = (int)items.size();
if(items.empty())
@@ -524,6 +530,7 @@ namespace QuickMedia {
offset_to_top = 0.0f;
offset_to_bottom = 0.0f;
mouse_left_clicked = false;
+ last_visible_item = -1;
return;
}
@@ -672,6 +679,7 @@ namespace QuickMedia {
draw_item(window, item.get(), prev_pos, size, item_height, i, content_progress, true, merge_with_previous);
glDisable(GL_SCISSOR_TEST);
++num_visible_items;
+ last_visible_item = i;
if(first_item_fully_visible)
first_fully_visible_item = i;
@@ -727,6 +735,7 @@ namespace QuickMedia {
after_pos.y += item_height;
after_pos.y += spacing_y;
++num_visible_items;
+ last_visible_item = i;
BodyItem *next_body_item = get_next_visible_item(i);
const bool merge_with_next = next_body_item && body_item_merge_handler && body_item_merge_handler(item.get(), next_body_item);