aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/Body.hpp1
-rw-r--r--src/Body.cpp18
2 files changed, 17 insertions, 2 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 8a3bce5..84d0f14 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -304,6 +304,7 @@ namespace QuickMedia {
float offset_to_top = 0.0f;
float offset_to_bottom = 0.0f;
int clamp_selected_item_to_body_count = 1;
+ int shit_hack_body_size_change = 0;
bool mouse_left_pressed = false;
bool mouse_left_clicked = false;
bool has_scrolled_with_input = false;
diff --git a/src/Body.cpp b/src/Body.cpp
index df9ba41..f316e2f 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -493,8 +493,17 @@ namespace QuickMedia {
body_pos = pos;
bool body_size_changed = std::abs(size.x - body_size.x) > 0.1f || std::abs(size.y - body_size.y) > 0.1f;
- if(body_size_changed)
+ if(body_size_changed) {
body_size = size;
+ shit_hack_body_size_change = 2;
+ }
+
+ if(shit_hack_body_size_change > 0)
+ body_size_changed = true;
+
+ shit_hack_body_size_change--;
+ if(shit_hack_body_size_change < 0)
+ shit_hack_body_size_change = 0;
elapsed_time_sec = draw_timer.getElapsedTime().asSeconds();
@@ -604,8 +613,13 @@ namespace QuickMedia {
selected_scrolled += scroll_smooth_diff;
+ if(body_size_changed) {
+ extra_scroll_current = extra_scroll_target;
+ prev_extra_scroll = extra_scroll_current;
+ }
+
bool selected_item_fits_on_screen = selected_item_height <= size.y;
- if(selected_item_fits_on_screen && render_selected_item_bg && !first_item_fully_visible && !last_item_fully_visible && items_cut_off && (selected_item == first_visible_item || selected_item == last_visible_item || selected_item == first_fully_visible_item || selected_item == last_fully_visible_item)) {
+ if(shit_hack_body_size_change == 0 && selected_item_fits_on_screen && render_selected_item_bg && !first_item_fully_visible && !last_item_fully_visible && items_cut_off && (selected_item == first_visible_item || selected_item == last_visible_item || selected_item == first_fully_visible_item || selected_item == last_fully_visible_item)) {
page_scroll += scroll_smooth_diff;
keep_selected_inside_body = false;
}