From 517bb4c859a2bb8d30316204f39bf5b6c89c3e4d Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 14 Jan 2011 19:09:23 -0800 Subject: Add support for detecting finger orientation. Change-Id: I901fc61f7705fcd7950190dc8782bad616032ee2 --- .../java/com/android/internal/widget/PointerLocationView.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/java') diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java index 12cf853..0b765fd 100644 --- a/core/java/com/android/internal/widget/PointerLocationView.java +++ b/core/java/com/android/internal/widget/PointerLocationView.java @@ -300,6 +300,17 @@ public class PointerLocationView extends View { mPaint.setARGB(255, pressureLevel, 128, 255 - pressureLevel); drawOval(canvas, ps.mCoords.x, ps.mCoords.y, ps.mCoords.toolMajor, ps.mCoords.toolMinor, ps.mCoords.orientation, mPaint); + + // Draw the orientation arrow. + mPaint.setARGB(255, pressureLevel, 255, 0); + float orientationVectorX = (float) (Math.sin(-ps.mCoords.orientation) + * ps.mCoords.toolMajor * 0.7); + float orientationVectorY = (float) (Math.cos(-ps.mCoords.orientation) + * ps.mCoords.toolMajor * 0.7); + canvas.drawLine( + ps.mCoords.x - orientationVectorX, ps.mCoords.y - orientationVectorY, + ps.mCoords.x + orientationVectorX, ps.mCoords.y + orientationVectorY, + mPaint); } } } -- cgit v1.1