aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-09-04 00:55:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-04 00:55:25 -0700
commit147a62a8a88a1b375ab43f09427de0765ba4e8dd (patch)
treebbcb597f15a56d533e911a99a8d007ca582a5052 /java/src/com
parentd34dd5bb6bb01666171a37e9cefe46bb20d04e93 (diff)
parent3f00c6151fb7140fb7752bad3b978daacd9ec5aa (diff)
downloadlatinime-147a62a8a88a1b375ab43f09427de0765ba4e8dd.tar.gz
latinime-147a62a8a88a1b375ab43f09427de0765ba4e8dd.tar.xz
latinime-147a62a8a88a1b375ab43f09427de0765ba4e8dd.zip
Merge "Reduce amount of empty space in which keypresses are detected" into jb-mr1-dev
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyDetector.java12
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;
}