Make the buttons work for edge pixels of the keyboard

Follow-up change to If7630b89

bug: 3142416
Change-Id: I2660e3d688eb0490363e460d5b4944c89b8ca35c
main
Ken Wakasa 2010-10-29 18:59:37 +09:00
parent 9dce586eaa
commit 69db35c493
2 changed files with 4 additions and 2 deletions

View File

@ -797,7 +797,9 @@ public class LatinKeyboard extends Keyboard {
if (mCurrentlyInSpace) {
return new int[] { mSpaceKeyIndex };
} else {
return super.getNearestKeys(x, y);
// Avoid dead pixels at edges of the keyboard
return super.getNearestKeys(Math.max(0, Math.min(x, getMinWidth() - 1)),
Math.max(0, Math.min(y, getHeight() - 1)));
}
}

View File

@ -83,4 +83,4 @@ class ProximityKeyDetector extends KeyDetector {
}
return primaryIndex;
}
}
}