I created a graphic object, and made it a button, my figure is Pentagon, but when I press the blank area next to the Pentagon, he will still trigger events, although there are not what is, the actual volume button rectangle in corona inside, I want more accurate click, I tried deformation, deformation is still only 4 points, it is clear that this is not what I want, the way to achieve my idea?I don’t want him to have an event on the red area
You can create a Polygon shape and use that as the touch area. So you got two objects, 1 is the graphic and the other one is the shape for the touch event.
https://docs.coronalabs.com/api/library/display/newPolygon.html
Another approach would be to create a Polygonshape and fill it with the grahic you want to use. This way you only got one graphic object afterwards.
Consider using histmasking
- https://docs.coronalabs.com/api/type/DisplayObject/isHitTestMasked.html
- https://docs.coronalabs.com/api/type/DisplayObject/isHitTestable.html
I have an example in the ‘Ask Ed’ section of my Free Stuff archive.
This is a old accompanying video for the above code sample
You can create a Polygon shape and use that as the touch area. So you got two objects, 1 is the graphic and the other one is the shape for the touch event.
https://docs.coronalabs.com/api/library/display/newPolygon.html
Another approach would be to create a Polygonshape and fill it with the grahic you want to use. This way you only got one graphic object afterwards.
Consider using histmasking
- https://docs.coronalabs.com/api/type/DisplayObject/isHitTestMasked.html
- https://docs.coronalabs.com/api/type/DisplayObject/isHitTestable.html
I have an example in the ‘Ask Ed’ section of my Free Stuff archive.
This is a old accompanying video for the above code sample