move the cursor more if the user does big swipes

This commit is contained in:
tibbi 2022-01-19 23:20:19 +01:00
parent 2702350471
commit eeb12143b0
1 changed files with 8 additions and 4 deletions

View File

@ -1372,11 +1372,15 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
if (mIsLongPressingSpace) { if (mIsLongPressingSpace) {
val diff = mLastX - mLastSpaceMoveX val diff = mLastX - mLastSpaceMoveX
if (diff > SPACE_MOVE_THRESHOLD) { if (diff < -SPACE_MOVE_THRESHOLD) {
onKeyboardActionListener?.moveCursorRight() for (i in diff / SPACE_MOVE_THRESHOLD until 0) {
onKeyboardActionListener?.moveCursorLeft()
}
mLastSpaceMoveX = mLastX mLastSpaceMoveX = mLastX
} else if (diff < -SPACE_MOVE_THRESHOLD) { } else if (diff > SPACE_MOVE_THRESHOLD) {
onKeyboardActionListener?.moveCursorLeft() for (i in 0 until diff / SPACE_MOVE_THRESHOLD) {
onKeyboardActionListener?.moveCursorRight()
}
mLastSpaceMoveX = mLastX mLastSpaceMoveX = mLastX
} }
} else if (!continueLongPress) { } else if (!continueLongPress) {