Do not pick up closest key if the point is out of any key

Bug: 3286308
Change-Id: I62771fb209027ddec4595d099d5d397ae4e200fd
main
Tadashi G. Takaoka 2010-12-19 20:34:32 +09:00
parent dbc44989a5
commit 6d929d586f
1 changed files with 1 additions and 8 deletions

View File

@ -36,8 +36,6 @@ public class ProximityKeyDetector extends KeyDetector {
final int touchY = getTouchY(y);
int primaryIndex = NOT_A_KEY;
int closestKeyIndex = NOT_A_KEY;
int closestKeyDist = mProximityThresholdSquare + 1;
final int[] distances = mDistances;
Arrays.fill(distances, Integer.MAX_VALUE);
for (final int index : mKeyboard.getNearestKeys(touchX, touchY)) {
@ -47,11 +45,6 @@ public class ProximityKeyDetector extends KeyDetector {
primaryIndex = index;
final int dist = key.squaredDistanceToEdge(touchX, touchY);
if (isInside || (mProximityCorrectOn && dist < mProximityThresholdSquare)) {
if (dist < closestKeyDist) {
closestKeyDist = dist;
closestKeyIndex = index;
}
if (allKeys == null) continue;
final int nCodes = key.mCodes.length;
// Find insertion point
@ -70,6 +63,6 @@ public class ProximityKeyDetector extends KeyDetector {
}
}
return primaryIndex == NOT_A_KEY ? closestKeyIndex : primaryIndex;
return primaryIndex;
}
}