Last active
May 11, 2020 06:48
-
-
Save Ash-Kay/73573503712e57ac9c8a6762b0163185 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onTouchEvent(event: MotionEvent?): Boolean { | |
when (event?.action) { | |
MotionEvent.ACTION_UP -> { | |
val touchPoint = PointF(event.x, event.y) | |
//Distance between two points | |
val distance = sqrt( | |
(centre.x - touchPoint.x).pow(2) | |
+ (centre.y - touchPoint.y).pow(2) | |
) | |
if (dis <= Constants.circleRadius) { | |
callOnClick() | |
} | |
} | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment