Skip to content

Commit 7857c36

Browse files
committed
Use the real finger position when scrolling
1 parent 7d3b452 commit 7857c36

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

menu/drivers/materialui.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,10 +3991,18 @@ static void materialui_render(void *data,
39913991
mui->scroll_y = 0.0f;
39923992
}
39933993
/* If fullscreen thumbnail view is enabled,
3994-
* scrolling is disabled - otherwise, just apply
3995-
* normal pointer acceleration */
3994+
* scrolling is disabled - otherwise, follow active
3995+
* touch drags directly and use acceleration for
3996+
* post-release inertial scrolling */
39963997
else if (!(mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS))
3997-
mui->scroll_y -= mui->pointer.y_accel;
3998+
{
3999+
if ( (mui->pointer.flags & MENU_INP_PTR_FLG_PRESSED)
4000+
&& (mui->pointer.flags & MENU_INP_PTR_FLG_DRAGGED))
4001+
mui->scroll_y = mui->pointer_start_scroll_y -
4002+
(float)(mui->pointer.y - mui->pointer_start_y);
4003+
else
4004+
mui->scroll_y -= mui->pointer.y_accel;
4005+
}
39984006
}
39994007

40004008
if (mui->scroll_y < 0.0f)
@@ -10706,6 +10714,10 @@ static int materialui_pointer_down(void *userdata,
1070610714
if (!mui)
1070710715
return -1;
1070810716

10717+
/* Any active scroll animation would otherwise fight
10718+
* direct list dragging */
10719+
materialui_kill_scroll_animation(mui, menu_st);
10720+
1070910721
/* Get initial pointer location and scroll position */
1071010722
mui->pointer_start_x = x;
1071110723
mui->pointer_start_y = y;
@@ -10784,10 +10796,6 @@ static int materialui_pointer_down(void *userdata,
1078410796

1078510797
/* User has 'selected' scrollbar */
1078610798

10787-
/* > Kill any existing scroll animation
10788-
* and reset scroll acceleration */
10789-
materialui_kill_scroll_animation(mui, menu_st);
10790-
1079110799
/* > Enable dragging */
1079210800
mui->flags |= MUI_FLAG_SCROLLBAR_DRAGGED;
1079310801

0 commit comments

Comments
 (0)