* commit 'c6791d6773f34990e9aac8f7219be82fa91ab92e': Utilize Rect's method
This commit is contained in:
commit
eebe4bb0c2
1 changed files with 4 additions and 6 deletions
|
@ -168,15 +168,13 @@ public class ProximityInfo {
|
||||||
final Rect hitBox = key.mHitBox;
|
final Rect hitBox = key.mHitBox;
|
||||||
final int row = hitBox.top / mKeyHeight;
|
final int row = hitBox.top / mKeyHeight;
|
||||||
if (row < touchPositionCorrection.mRadii.length) {
|
if (row < touchPositionCorrection.mRadii.length) {
|
||||||
final float hitBoxCenterX = (hitBox.left + hitBox.right) * 0.5f;
|
final int hitBoxWidth = hitBox.width();
|
||||||
final float hitBoxCenterY = (hitBox.top + hitBox.bottom) * 0.5f;
|
final int hitBoxHeight = hitBox.height();
|
||||||
final float hitBoxWidth = hitBox.right - hitBox.left;
|
|
||||||
final float hitBoxHeight = hitBox.bottom - hitBox.top;
|
|
||||||
final float x = touchPositionCorrection.mXs[row];
|
final float x = touchPositionCorrection.mXs[row];
|
||||||
final float y = touchPositionCorrection.mYs[row];
|
final float y = touchPositionCorrection.mYs[row];
|
||||||
final float radius = touchPositionCorrection.mRadii[row];
|
final float radius = touchPositionCorrection.mRadii[row];
|
||||||
sweetSpotCenterXs[i] = hitBoxCenterX + x * hitBoxWidth;
|
sweetSpotCenterXs[i] = hitBox.exactCenterX() + x * hitBoxWidth;
|
||||||
sweetSpotCenterYs[i] = hitBoxCenterY + y * hitBoxHeight;
|
sweetSpotCenterYs[i] = hitBox.exactCenterY() + y * hitBoxHeight;
|
||||||
sweetSpotRadii[i] = radius * FloatMath.sqrt(
|
sweetSpotRadii[i] = radius * FloatMath.sqrt(
|
||||||
hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight);
|
hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue