mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Consolidate data and algorithm of calculating rounded line (Step 1)
Change-Id: Ic6d72b5a34ddfbc55317fa651f78af6f50c9a284
This commit is contained in:
parent
9b935084ea
commit
0d034b3169
@ -144,12 +144,11 @@ final class GesturePreviewTrail {
|
|||||||
// Sweep angle of the trail arc at P2.
|
// Sweep angle of the trail arc at P2.
|
||||||
public float a2;
|
public float a2;
|
||||||
public RectF arc2 = new RectF();
|
public RectF arc2 = new RectF();
|
||||||
}
|
|
||||||
|
|
||||||
private static final float RIGHT_ANGLE = (float)(Math.PI / 2.0d);
|
|
||||||
private static final float RADIAN_TO_DEGREE = (float)(180.0d / Math.PI);
|
private static final float RADIAN_TO_DEGREE = (float)(180.0d / Math.PI);
|
||||||
|
private static final float RIGHT_ANGLE = (float)(Math.PI / 2.0d);
|
||||||
|
|
||||||
private static boolean calculatePathPoints(final WorkingSet w) {
|
public static boolean calculatePathPoints(final WorkingSet w) {
|
||||||
final float dx = w.p2x - w.p1x;
|
final float dx = w.p2x - w.p1x;
|
||||||
final float dy = w.p2y - w.p1y;
|
final float dy = w.p2y - w.p1y;
|
||||||
// Distance of the points.
|
// Distance of the points.
|
||||||
@ -190,7 +189,7 @@ final class GesturePreviewTrail {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createPath(final Path path, final WorkingSet w) {
|
public static void createPath(final Path path, final WorkingSet w) {
|
||||||
path.rewind();
|
path.rewind();
|
||||||
// Trail cap at P1.
|
// Trail cap at P1.
|
||||||
path.moveTo(w.p1x, w.p1y);
|
path.moveTo(w.p1x, w.p1y);
|
||||||
@ -207,6 +206,7 @@ final class GesturePreviewTrail {
|
|||||||
path.lineTo(w.p2ax, w.p2ay);
|
path.lineTo(w.p2ax, w.p2ay);
|
||||||
path.close();
|
path.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final WorkingSet mWorkingSet = new WorkingSet();
|
private final WorkingSet mWorkingSet = new WorkingSet();
|
||||||
private final Path mPath = new Path();
|
private final Path mPath = new Path();
|
||||||
@ -262,8 +262,8 @@ final class GesturePreviewTrail {
|
|||||||
paint.setAlpha(alpha);
|
paint.setAlpha(alpha);
|
||||||
final float width = getWidth(elapsedTime, params);
|
final float width = getWidth(elapsedTime, params);
|
||||||
w.r2 = width / 2.0f;
|
w.r2 = width / 2.0f;
|
||||||
if (calculatePathPoints(w)) {
|
if (WorkingSet.calculatePathPoints(w)) {
|
||||||
createPath(path, w);
|
WorkingSet.createPath(path, w);
|
||||||
canvas.drawPath(path, paint);
|
canvas.drawPath(path, paint);
|
||||||
outBoundsRect.union((int)w.p2x, (int)w.p2y);
|
outBoundsRect.union((int)w.p2x, (int)w.p2y);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user