Do not pick up closest key if the point is out of any key
Bug: 3286308 Change-Id: I62771fb209027ddec4595d099d5d397ae4e200fdmain
parent
dbc44989a5
commit
6d929d586f
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue