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

Commit b3c1d198 authored by Haoyu Zhang's avatar Haoyu Zhang Committed by Android (Google) Code Review
Browse files

Merge "Scribe in View: disable cursor drag when handwriting is enabled" into tm-dev

parents 6cd9dd19 b989691d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -6309,7 +6309,8 @@ public class Editor {
            }
            switch (event.getActionMasked()) {
                case MotionEvent.ACTION_MOVE:
                    if (event.isFromSource(InputDevice.SOURCE_MOUSE)) {
                    if (event.isFromSource(InputDevice.SOURCE_MOUSE)
                            || (mTextView.isAutoHandwritingEnabled() && isFromStylus(event))) {
                        break;
                    }
                    if (mIsDraggingCursor) {
@@ -6332,6 +6333,11 @@ public class Editor {
            }
        }

        private boolean isFromStylus(MotionEvent motionEvent) {
            final int pointerIndex = motionEvent.getActionIndex();
            return motionEvent.getToolType(pointerIndex) == MotionEvent.TOOL_TYPE_STYLUS;
        }

        private void positionCursorDuringDrag(MotionEvent event) {
            mPrevLineDuringDrag = getLineDuringDrag(event);
            int offset = mTextView.getOffsetAtCoordinate(mPrevLineDuringDrag, event.getX());