Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CGAffineTransform at;
- CGContextRef context;
- CGPathRef ref;
- - (void)drawRect:(CGRect)rect {
- // Drawing code.
- context = UIGraphicsGetCurrentContext();
- at = CGAffineTransformMake(scale, rotate, rotate, scale, dragX+howMuchDraggedX, dragY+howMuchDraggedY);
- CGContextConcatCTM(context, at);
- for (int i=0; i<[arrayOfPaths count]; i++) {
- PathArea* pathValue = [arrayOfPaths objectAtIndex:i];
- CGContextAddPath(context, pathValue.pathRef);
- }
- CGContextFillPath(context);
- }
- -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- {
- NSSet* setOfTouch = [event allTouches];
- UITouch *touch = [[setOfTouch allObjects] objectAtIndex:0];
- CGPoint point = [touch locationInView:self];
- for (int i=0; i<[arrayOfPaths count]; i++) {
- PathArea* path = [arrayOfPaths objectAtIndex:i];
- CGAffineTransform trans = CGAffineTransformMakeScale(scale, scale);
- // It doesn't work !!!
- NSLog(@"%d" ,CGPathContainsPoint(path.pathRef, &trans, point, TRUE));
- // if i check it for dragging. It works!
- // CGAffineTransform trans =
- // CGAffineTransformMakeTranslation(-(dragX+howMuchDraggedX), -(dragY+howMuchDraggedY));
- // NSLog(@"%d" ,CGPathContainsPoint(path.pathRef, &trans, point, TRUE));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment