FIX: Wrong way to gesture speed calculation.
This is a follow-up to bug: 7165929
Change-Id: I7ad2bbd1f6ef1f74ea8770585f584d4232cb40b5
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index fbca720..392ec81 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -179,7 +179,9 @@
duration = times[index] - times[index - 1];
} else if (0 < index && index < inputSize - 1) {
length = getDistanceInt(xCoordinates[index - 1], yCoordinates[index - 1],
- xCoordinates[index + 1], yCoordinates[index + 1]);
+ xCoordinates[index], yCoordinates[index])
+ + getDistanceInt(xCoordinates[index], yCoordinates[index],
+ xCoordinates[index + 1], yCoordinates[index + 1]);
duration = times[index + 1] - times[index - 1];
} else {
length = 0;
@@ -509,7 +511,7 @@
return min(mDistanceCache[index] * scale, mMaxPointToKeyLength);
}
if (isSkippableChar(codePoint)) {
- return 0;
+ return 0.0f;
}
// If the char is not a key on the keyboard then return the max length.
return MAX_POINT_TO_KEY_LENGTH;