How to set hit area for an image

You must Login before you can answer or comment on any questions.

I would like to set the hit area for an image, for example a circle created with createImage and borderRadius:50 When you tap out of the circle it still calling the click event, because the hit area still a rectangle

1 Answer

Accepted Answer

See my answer to a very similar question. Use the x and y properties of the click event and do the math to determine if it's inside the circle. If the tap is not inside the circle, ignore the event.

— answered 12 months ago by Jason Priebe
answer permalink
2 Comments
  • thx for the answers, it might work but I though titanium would have something native to do this, as other sdk's do, cause calculating the X and Y is not going to accelerate the app develop.

    — commented 12 months ago by Cleison Moreira Pereira

  • there is other ugly workaround, drawing a lot of rectangles to handle the borders and make it looks like a circle or other shape.

    but...

    — commented 12 months ago by Ezoom Digital Experience

Your Answer

This question has been locked and cannot accept new answers.