I want to detect if touch in the canvas view is inside the oval or not.
Current code:
override fun draw(canvas: Canvas, paint: Paint) {
val rectF = RectF(200F, 300F, 100F, 100F)
canvas.drawOval(rectF, paint)
}
override fun onTouchEvent(event: MotionEvent): Boolean {
val value = super.onTouchEvent(event)
when (event.action) {
MotionEvent.ACTION_DOWN ->{
return true
}
MotionEvent.ACTION_MOVE -> {
// detect touch inside oval in canvas
return true
}
MotionEvent.ACTION_UP -> {
return true
}
}
return value
}