aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-17 05:25:55 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-17 05:25:55 +0200
commit6d26716f33191217b24e1d05eb2f9c59704e0d94 (patch)
tree90895e04fbd292c43018ab8e928057a8e86c60bc /src
parent7b3e55d2c7c77013fec8103bf52c2cbb23fb4935 (diff)
Keep selected item inside body on resize
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp18
1 files changed, 16 insertions, 2 deletions
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;
}