diff options
author | 2010-09-15 07:07:01 -0700 | |
---|---|---|
committer | 2010-09-15 07:07:01 -0700 | |
commit | 53a68e7dcfaed08a79107612d441424fb8920272 (patch) | |
tree | 7cbaabdbcfd09796b39456e6b35aaee6835963d7 /java/src/com/android/inputmethod/latin/PointerTracker.java | |
parent | 22a2215c1ee086844bfbd2d1366f027a7468f828 (diff) | |
parent | b2835ef2e506b7d1b3db1c810b7dae349d2461d2 (diff) | |
download | latinime-53a68e7dcfaed08a79107612d441424fb8920272.tar.gz latinime-53a68e7dcfaed08a79107612d441424fb8920272.tar.xz latinime-53a68e7dcfaed08a79107612d441424fb8920272.zip |
am b2835ef2: am eb680367: Add keyHysteresisDistance xml attribute
Merge commit 'b2835ef2e506b7d1b3db1c810b7dae349d2461d2'
* commit 'b2835ef2e506b7d1b3db1c810b7dae349d2461d2':
Add keyHysteresisDistance xml attribute
Diffstat (limited to 'java/src/com/android/inputmethod/latin/PointerTracker.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/PointerTracker.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index e10c9b862..958e57618 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -55,7 +55,7 @@ public class PointerTracker { private final boolean mHasDistinctMultitouch; private Key[] mKeys; - private int mKeyDebounceThresholdSquared = -1; + private int mKeyHysteresisDistanceSquared = -1; private int mCurrentKey = NOT_A_KEY; private int mStartX; @@ -106,11 +106,11 @@ public class PointerTracker { mListener = listener; } - public void setKeyboard(Key[] keys, float hysteresisPixel) { - if (keys == null || hysteresisPixel < 1.0f) + public void setKeyboard(Key[] keys, float keyHysteresisDistance) { + if (keys == null || keyHysteresisDistance < 0) throw new IllegalArgumentException(); mKeys = keys; - mKeyDebounceThresholdSquared = (int)(hysteresisPixel * hysteresisPixel); + mKeyHysteresisDistanceSquared = (int)(keyHysteresisDistance * keyHysteresisDistance); // Update current key index because keyboard layout has been changed. mCurrentKey = mKeyDetector.getKeyIndexAndNearbyCodes(mStartX, mStartY, null); } @@ -335,13 +335,12 @@ public class PointerTracker { } private boolean isMinorMoveBounce(int x, int y, int newKey, int curKey) { - if (mKeys == null || mKeyDebounceThresholdSquared < 0) + if (mKeys == null || mKeyHysteresisDistanceSquared < 0) throw new IllegalStateException("keyboard and/or hysteresis not set"); if (newKey == curKey) { return true; } else if (isValidKeyIndex(curKey)) { - return getSquareDistanceToKeyEdge(x, y, mKeys[curKey]) - < mKeyDebounceThresholdSquared; + return getSquareDistanceToKeyEdge(x, y, mKeys[curKey]) < mKeyHysteresisDistanceSquared; } else { return false; } |