Suppress cursor drag when the user swipes vertically
When the EditText component is wrapped in a ScrollView or another scrollable component, vertical scrolling works without any explicit logic to suppress the cursor drag. But if the EditText component is not placed in a scrolling container, swiping vertically will trigger a cursor drag instead of scrolling unless we add some explicit logic to suppress the drag for vertical swiping. The change here implements explicit logic to disambiguate dragging the cursor vs scrolling. This is done using the following heuristic: the swipe direction angle must be greater than 30 degrees from vertical in order to trigger the cursor drag. Otherwise the existing handlers will pick up the gesture (e.g. scrolling). Bug: 143852764, 145833335 Test: Manual and unit tests atest FrameworksCoreTests:EditorCursorDragTest Change-Id: Ibc5b2317e06cc36b221609c716c858ad0a70d577
Loading
Please register or sign in to comment