diff options
Diffstat (limited to 'native/jni/src/proximity_info.h')
-rw-r--r-- | native/jni/src/proximity_info.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/native/jni/src/proximity_info.h b/native/jni/src/proximity_info.h index 8a407e71a..7ee633ba8 100644 --- a/native/jni/src/proximity_info.h +++ b/native/jni/src/proximity_info.h @@ -41,21 +41,12 @@ class ProximityInfo { float getNormalizedSquaredDistanceFromCenterFloat( const int keyId, const int x, const int y) const; bool sameAsTyped(const unsigned short *word, int length) const; - int squaredDistanceToEdge(const int keyId, const int x, const int y) const; - bool isOnKey(const int keyId, const int x, const int y) const { - if (keyId < 0) return true; // NOT_A_ID is -1, but return whenever < 0 just in case - const int left = mKeyXCoordinates[keyId]; - const int top = mKeyYCoordinates[keyId]; - const int right = left + mKeyWidths[keyId] + 1; - const int bottom = top + mKeyHeights[keyId]; - return left < right && top < bottom && x >= left && x < right && y >= top && y < bottom; - } int getKeyIndex(const int c) const; int getKeyCode(const int keyIndex) const; bool hasSweetSpotData(const int keyIndex) const { // When there are no calibration data for a key, // the radius of the key is assigned to zero. - return mSweetSpotRadii[keyIndex] > 0.0; + return mSweetSpotRadii[keyIndex] > 0.0f; } float getSweetSpotRadiiAt(int keyIndex) const { return mSweetSpotRadii[keyIndex]; @@ -111,10 +102,6 @@ class ProximityInfo { float getKeyCenterYOfIdG(int keyId) const; int getKeyKeyDistanceG(int key0, int key1) const; - // Returns the keyboard key-center information. - void getCenters(int *centersX, int *centersY, int *codeToKeyIndex, int *keyToCodeIndex, - int *keyCount, int *keyWidth) const; - private: DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfo); // The max number of the keys in one keyboard layout @@ -131,6 +118,15 @@ class ProximityInfo { float calculateSquaredDistanceFromSweetSpotCenter( const int keyIndex, const int inputIndex) const; bool hasInputCoordinates() const; + int squaredDistanceToEdge(const int keyId, const int x, const int y) const; + bool isOnKey(const int keyId, const int x, const int y) const { + if (keyId < 0) return true; // NOT_A_ID is -1, but return whenever < 0 just in case + const int left = mKeyXCoordinates[keyId]; + const int top = mKeyYCoordinates[keyId]; + const int right = left + mKeyWidths[keyId] + 1; + const int bottom = top + mKeyHeights[keyId]; + return left < right && top < bottom && x >= left && x < right && y >= top && y < bottom; + } const int MAX_PROXIMITY_CHARS_SIZE; const int KEYBOARD_WIDTH; |