diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-21 10:28:52 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-22 14:45:26 +0000 |
commit | 569b165cff2330c5c7dfd6b1aa175008729b4414 (patch) | |
tree | 8f18b4cf618fc7d40323d2998951b3f2d1299770 /apps/gui | |
parent | a59a629514c5084e23848157671a336202955b53 (diff) |
touchscreen: handle scrollbar properly when UI viewport is used
Change-Id: I3b55233f4d50f5b8ae38f9f337ebdee6f93ad44e
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/bitmap/list.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 2b5a99fb9f..db8e0504d7 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -359,8 +359,7 @@ static enum { SCROLL_KINETIC, /* state after releasing swipe */ } scroll_mode; -static int scrollbar_scroll(struct gui_synclist * gui_list, - int y) +static int scrollbar_scroll(struct gui_synclist * gui_list, int y) { const int screen = screens[SCREEN_MAIN].screen_type; const int nb_lines = list_get_nb_lines(gui_list, screen); @@ -369,11 +368,9 @@ static int scrollbar_scroll(struct gui_synclist * gui_list, { /* scrollbar scrolling is still line based */ y_offset = 0; - int scrollbar_size = nb_lines*gui_list->line_height[screen]; + int scrollbar_size = nb_lines * gui_list->line_height[screen]; int actual_y = y - list_text[screen].y; - - int new_selection = (actual_y * gui_list->nb_items) - / scrollbar_size; + int new_selection = (actual_y * gui_list->nb_items) / scrollbar_size; int start_item = new_selection - nb_lines/2; if(start_item < 0) @@ -839,7 +836,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list) hide_selection = true; /* similarly to swipe scroll, using the scrollbar grabs * focus so the click location is irrelevant */ - scrollbar_scroll(list, adj_y); + scrollbar_scroll(list, y); if (action & BUTTON_REL) scroll_mode = SCROLL_NONE; break; |