Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43fd2f42 authored by Mady Mellor's avatar Mady Mellor
Browse files

Text selection: update touch delta when moving towards handles

When the text selection drag handles jump to the end / start of a
word, the delta between the current touch position and where the
handle jumps to is tracked. Previously this value was not updated
if the handle jumped and then the finger moved towards the handle.

This CL adjusts the logic to update the delta in this situation.

Bug: 21131483
Change-Id: I331f53191103e1a3fc08e34b5df5cd6cbc177af6
parent e1f3214e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4131,6 +4131,11 @@ public class Editor {
                        offset = adjustedOffset;
                    }
                    positionCursor = true;
                } else if (adjustedOffset < mPreviousOffset) {
                    // Handle has jumped to the start of the word, and the user is moving
                    // their finger towards the handle, the delta should be updated.
                    mTouchWordDelta = mTextView.convertToLocalHorizontalCoordinate(x)
                            - layout.getPrimaryHorizontal(mPreviousOffset);
                }
            }

@@ -4258,6 +4263,11 @@ public class Editor {
                        offset = adjustedOffset;
                    }
                    positionCursor = true;
                } else if (adjustedOffset > mPreviousOffset) {
                    // Handle has jumped to the end of the word, and the user is moving
                    // their finger towards the handle, the delta should be updated.
                    mTouchWordDelta = layout.getPrimaryHorizontal(mPreviousOffset)
                            - mTextView.convertToLocalHorizontalCoordinate(x);
                }
            }