Skip to content

Commit 44f0355

Browse files
committed
[TimePicker] Fix isInTapRegion check
1 parent 7ae12b5 commit 44f0355

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/java/com/google/android/material/timepicker/ClockHandView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,7 @@ public boolean onTouchEvent(MotionEvent event) {
316316
break;
317317
case MotionEvent.ACTION_MOVE:
318318
case MotionEvent.ACTION_UP:
319-
final int deltaX = (int) (x - downX);
320-
final int deltaY = (int) (y - downY);
321-
int distance = (deltaX * deltaX) + (deltaY * deltaY);
319+
double distance = Math.hypot(x - downX, y - downY);
322320
isInTapRegion = distance > scaledTouchSlop;
323321
// If we saw a down/up pair without the value changing, assume
324322
// this is a single-tap selection and force a change.

0 commit comments

Comments
 (0)