Update gesture bounding box handling.

Change-Id: I085611ce6fd82608f284d74973e5bb14258cdc24
main
Tom Ouyang 2012-07-22 08:36:13 +09:00
parent 7e220d3c3a
commit ccaa799ee9
3 changed files with 7 additions and 8 deletions

View File

@ -919,15 +919,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
if (mPreviewPlacer == null) {
createPreviewPlacer();
}
final Rect r = tracker.getDrawingRect();
final Rect r = tracker.getBoundingBox();
if (!r.isEmpty()) {
// Invalidate the rectangular region encompassing the gesture. This is needed because
// past points along the gesture will fade and gradually disappear.
final KeyPreviewDrawParams params = mKeyPreviewDrawParams;
mInvalidatedGesturesRect.set(r.left + params.mCoordinates[0] - GESTURE_DRAWING_WIDTH,
r.top + params.mCoordinates[1] - GESTURE_DRAWING_WIDTH,
r.right + params.mCoordinates[0] + GESTURE_DRAWING_WIDTH,
r.bottom + params.mCoordinates[1] + GESTURE_DRAWING_WIDTH);
mInvalidatedGesturesRect.set(r);
mInvalidatedGesturesRect.offset(params.mCoordinates[0], params.mCoordinates[1]);
mInvalidatedGesturesRect.inset(-GESTURE_DRAWING_WIDTH, -GESTURE_DRAWING_WIDTH);
mPreviewPlacer.invalidate(mInvalidatedGesturesRect);
} else {
mPreviewPlacer.invalidate();

View File

@ -536,8 +536,8 @@ public class PointerTracker {
public long getDownTime() {
return mDownTime;
}
public Rect getDrawingRect() {
return mGestureStroke.getDrawingRect();
public Rect getBoundingBox() {
return mGestureStroke.getBoundingBox();
}
private Key onDownKey(int x, int y, long eventTime) {

View File

@ -199,7 +199,7 @@ public class GestureStroke {
}
}
public Rect getDrawingRect() {
public Rect getBoundingBox() {
return mDrawingRect;
}
}