Is there a way to ignore touch events over transparent sections of a PNG? [import]uid: 4596 topic_id: 9869 reply_id: 309869[/import]
Not at present; can you give me an indication of what kind of shape we’re talking about here?
Peach
[import]uid: 52491 topic_id: 9869 reply_id: 36085[/import]
Two things to keep in mind:
First off, fingers touching aren’t that accurate so for most images it won’t matter. Sometimes people forget this because they’re only testing in the simulator.
For situations where the transparent area is huge and thus noticeable, you can work around the problem by putting a few invisible rectangles over the object and listen for touches on those:
http://developer.anscamobile.com/content/objectishittestable
Not trivially easy, but because of the first point you can get away with fewer pieces than you might expect. [import]uid: 12108 topic_id: 9869 reply_id: 36096[/import]
Any image in general, for example this one I googled - http://upload.wikimedia.org/wikipedia/en/e/e8/Banksia_man.png
The bounding box contains empty space which I wouldn’t want to respond to touches to.
@jhocking Thanks for the suggestion [import]uid: 4596 topic_id: 9869 reply_id: 36138[/import]
ignoring transparent bits on an image won’t work.
create a polygon around the non transparent image and then do a point in polygon detection – if you have more than one polygon, create a group, add each polygon to the group, then traverse the group to see if the pt hits inside of n polygon.
c. [import]uid: 24 topic_id: 9869 reply_id: 36147[/import]