remove the threshold
This commit is contained in:
parent
89ccb7749f
commit
e921b2bbb1
|
@ -10,7 +10,6 @@ import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public class MyCanvas extends View {
|
public class MyCanvas extends View {
|
||||||
private static final float THRESHOLD = 5;
|
|
||||||
private Paint paint;
|
private Paint paint;
|
||||||
private Path path;
|
private Path path;
|
||||||
private float startX;
|
private float startX;
|
||||||
|
@ -39,14 +38,10 @@ public class MyCanvas extends View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void actionMove(float x, float y) {
|
private void actionMove(float x, float y) {
|
||||||
final float dx = Math.abs(x - startX);
|
|
||||||
final float dy = Math.abs(y - startY);
|
|
||||||
if (dx >= THRESHOLD || dy >= THRESHOLD) {
|
|
||||||
path.quadTo(startX, startY, (x + startX) / 2, (y + startY) / 2);
|
path.quadTo(startX, startY, (x + startX) / 2, (y + startY) / 2);
|
||||||
startX = x;
|
startX = x;
|
||||||
startY = y;
|
startY = y;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void actionUp() {
|
private void actionUp() {
|
||||||
path.lineTo(startX, startY);
|
path.lineTo(startX, startY);
|
||||||
|
|
Loading…
Reference in New Issue