Question

question is....

i need to handle tap gesture.

Now, i have a lot of paths builded by CGPath (each path has an ID), and by CGContextAddPath i create and fill my planimetry. Whether i tap on a path, i wish that right ID is shown.

So, i'm using CGPathContainsPoint in touchbegin to do this but, if i scale up or down my planimetry by CGAffineTransform, CGPathContainsPoint method returns wrong information (FALSE) also if i touch on a (scaled) path.

How can i fix it ?! I tried by adding CGAffineTransform element as second argument of CGPathContainsPoint method but point touched isn't scaled too, so, nothing happens (instead, the same problem with translation is fixed by this same way!).

Here you can find the CODE semplified

Sorry for my english ( i'm italian ) :P

Thx in advance

Was it helpful?

Solution

OK! I found the problem !!! I have to apply the inverse function!!

If i scale by 10, i have to scale the point by 1 / 10.

For translation if i drag by 10, i have to drag back by -10 (for rotating the same i think).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top