aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeisuke Kuroynagi <ksk@google.com>2013-06-24 03:26:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-06-24 03:26:55 +0000
commit80a4b7c92e96d359e0360f85b2ed3ed128ad0f3f (patch)
treef2b5ecfb4c5311709db7d4266f78156d3ac931d4
parent564ad4927c784e541e7f00bb17bea416cb06115e (diff)
parent77ec8713cef76a14bf7df27a1f669711afa88f54 (diff)
downloadlatinime-80a4b7c92e96d359e0360f85b2ed3ed128ad0f3f.tar.gz
latinime-80a4b7c92e96d359e0360f85b2ed3ed128ad0f3f.tar.xz
latinime-80a4b7c92e96d359e0360f85b2ed3ed128ad0f3f.zip
Merge "Extend center point vertically for bottom keys on a keyboard."
-rw-r--r--native/jni/src/suggest/core/layout/proximity_info.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/native/jni/src/suggest/core/layout/proximity_info.cpp b/native/jni/src/suggest/core/layout/proximity_info.cpp
index 05826a5a1..e64476d82 100644
--- a/native/jni/src/suggest/core/layout/proximity_info.cpp
+++ b/native/jni/src/suggest/core/layout/proximity_info.cpp
@@ -215,22 +215,30 @@ int ProximityInfo::getKeyCenterXOfKeyIdG(
return centerX;
}
-// referencePointY is currently not used because we don't specially handle keys higher than the
-// most common key height. When the referencePointY is NOT_A_COORDINATE, this method should
-// calculate the return value without using the line segment.
+// When the referencePointY is NOT_A_COORDINATE, this method calculates the return value without
+// using the line segment.
int ProximityInfo::getKeyCenterYOfKeyIdG(
const int keyId, const int referencePointY, const bool isGeometric) const {
// TODO: Remove "isGeometric" and have separate "proximity_info"s for gesture and typing.
if (keyId < 0) {
return 0;
}
+ int centerY;
if (!hasTouchPositionCorrectionData()) {
- return mCenterYsG[keyId];
+ centerY = mCenterYsG[keyId];
} else if (isGeometric) {
- return static_cast<int>(mSweetSpotCenterYsG[keyId]);
+ centerY = static_cast<int>(mSweetSpotCenterYsG[keyId]);
} else {
- return static_cast<int>(mSweetSpotCenterYs[keyId]);
+ centerY = static_cast<int>(mSweetSpotCenterYs[keyId]);
}
+ if (referencePointY != NOT_A_COORDINATE &&
+ centerY + mKeyHeights[keyId] > KEYBOARD_HEIGHT && centerY < referencePointY) {
+ // When the distance between center point and bottom edge of the keyboard is shorter than
+ // the key height, we assume the key is located at the bottom row of the keyboard.
+ // The center point is extended to the bottom edge for such keys.
+ return referencePointY;
+ }
+ return centerY;
}
int ProximityInfo::getKeyKeyDistanceG(const int keyId0, const int keyId1) const {