Merge pull request #566 from Helium314/patch-4

Reduce sensitivty of space / delete gestures
This commit is contained in:
Majeur 2022-03-15 15:53:36 +01:00 committed by GitHub
commit 077a8d944e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,8 @@
package org.dslul.openboard.inputmethod.keyboard;
import static java.lang.Math.abs;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.SystemClock;
@ -907,7 +909,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
if (oldKey != null && oldKey.getCode() == Constants.CODE_SPACE && Settings.getInstance().getCurrent().mSpaceTrackpadEnabled) {
//Pointer slider
int steps = (x - mStartX) / sPointerStep;
final int longpressTimeout = Settings.getInstance().getCurrent().mKeyLongpressTimeout / MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT;
final int longpressTimeout = 2 * Settings.getInstance().getCurrent().mKeyLongpressTimeout / MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT;
if (steps != 0 && mStartTime + longpressTimeout < System.currentTimeMillis()) {
mCursorMoved = true;
mStartX += steps * sPointerStep;
@ -919,7 +921,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
if (oldKey != null && oldKey.getCode() == Constants.CODE_DELETE && Settings.getInstance().getCurrent().mDeleteSwipeEnabled) {
//Delete slider
int steps = (x - mStartX) / sPointerStep;
if (steps != 0) {
if (abs(steps) > 2 || (mCursorMoved && steps != 0)) {
sTimerProxy.cancelKeyTimersOf(this);
mCursorMoved = true;
mStartX += steps * sPointerStep;