diff options
author | 2012-09-04 14:50:56 +0900 | |
---|---|---|
committer | 2012-09-04 16:11:21 +0900 | |
commit | 3f00c6151fb7140fb7752bad3b978daacd9ec5aa (patch) | |
tree | 8ddc5496de5e603df83bb823f074dbfbc9748b83 /java/src | |
parent | 2c0c1cc677b947521384c5b9bc2b7b0469929581 (diff) | |
download | latinime-3f00c6151fb7140fb7752bad3b978daacd9ec5aa.tar.gz latinime-3f00c6151fb7140fb7752bad3b978daacd9ec5aa.tar.xz latinime-3f00c6151fb7140fb7752bad3b978daacd9ec5aa.zip |
Reduce amount of empty space in which keypresses are detected
Bug: 6942329
Change-Id: Ie92ccf43f307b8ceb9a311c30390d0cb2abf2cd7
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyDetector.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 868c8cab5..f5686dcda 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -83,11 +83,17 @@ public class KeyDetector { int minDistance = Integer.MAX_VALUE; Key primaryKey = null; for (final Key key: mKeyboard.getNearestKeys(touchX, touchY)) { - final boolean isOnKey = key.isOnKey(touchX, touchY); + // An edge key always has its enlarged hitbox to respond to an event that occurred in + // the empty area around the key. (@see Key#markAsLeftEdge(KeyboardParams)} etc.) + if (!key.isOnKey(touchX, touchY)) { + continue; + } final int distance = key.squaredDistanceToEdge(touchX, touchY); + if (distance > minDistance) { + continue; + } // To take care of hitbox overlaps, we compare mCode here too. - if (primaryKey == null || distance < minDistance - || (distance == minDistance && isOnKey && key.mCode > primaryKey.mCode)) { + if (primaryKey == null || distance < minDistance || key.mCode > primaryKey.mCode) { minDistance = distance; primaryKey = key; } |