From a1c27492ee82c84c160fb6f54575ef669f57e7c6 Mon Sep 17 00:00:00 2001 From: moritz haarmann Date: Wed, 19 Mar 2014 11:55:44 +0100 Subject: [PATCH] + Pinch to Zoom --- Classes/BITImageAnnotationViewController.m | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Classes/BITImageAnnotationViewController.m b/Classes/BITImageAnnotationViewController.m index 3dc2f27b55..d5b944e19e 100644 --- a/Classes/BITImageAnnotationViewController.m +++ b/Classes/BITImageAnnotationViewController.m @@ -207,8 +207,27 @@ self.pinchStartingFrame = self.currentAnnotation.frame; } - } else if (gestureRecognizer.state == UIGestureRecognizerStateChanged && self.currentAnnotation){ + } else if (gestureRecognizer.state == UIGestureRecognizerStateChanged && self.currentAnnotation && gestureRecognizer.numberOfTouches>1){ CGRect newFrame= (self.pinchStartingFrame); + NSLog(@"%f", [gestureRecognizer scale]); + + // upper point? + CGPoint point1 = [gestureRecognizer locationOfTouch:0 inView:self.view]; + CGPoint point2 = [gestureRecognizer locationOfTouch:1 inView:self.view]; + + + newFrame.origin.x = point1.x; + newFrame.origin.y = point1.y; + + newFrame.origin.x = (point1.x > point2.x) ? point2.x : point1.x; + newFrame.origin.y = (point1.y > point2.y) ? point2.y : point1.y; + + newFrame.size.width = (point1.x > point2.x) ? point1.x - point2.x : point2.x - point1.x; + newFrame.size.height = (point1.y > point2.y) ? point1.y - point2.y : point2.y - point1.y; + + + self.currentAnnotation.frame = newFrame; + // we } else {