diff --git a/Classes/BITArrowImageAnnotation.m b/Classes/BITArrowImageAnnotation.m index c45e5e2f06..0edc1af006 100644 --- a/Classes/BITArrowImageAnnotation.m +++ b/Classes/BITArrowImageAnnotation.m @@ -66,9 +66,7 @@ endY = CGRectGetMinY(self.bounds); } - - NSLog(@"Start X: %f, Y: %f, END: %f %f %@", startX, startY, endX,endY, self); - + UIBezierPath *path = [self bezierPathWithArrowFromPoint:CGPointMake(endX,endY) toPoint:CGPointMake(startX,startY) tailWidth:lineWidth headWidth:topHeight headLength:topHeight]; self.shapeLayer.path = path.CGPath; diff --git a/Classes/BITImageAnnotation.h b/Classes/BITImageAnnotation.h index 6449301275..f848ee2484 100644 --- a/Classes/BITImageAnnotation.h +++ b/Classes/BITImageAnnotation.h @@ -12,4 +12,7 @@ @property (nonatomic) CGSize movedDelta; @property (nonatomic, weak) UIImage *sourceImage; @property (nonatomic) CGRect imageFrame; + +-(BOOL)resizable; + @end diff --git a/Classes/BITImageAnnotation.m b/Classes/BITImageAnnotation.m index 644a27b379..d0e42614e3 100644 --- a/Classes/BITImageAnnotation.m +++ b/Classes/BITImageAnnotation.m @@ -21,14 +21,8 @@ } - -/* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect -{ - // Drawing code +-(BOOL)resizable { + return NO; } -*/ @end diff --git a/Classes/BITImageAnnotationViewController.m b/Classes/BITImageAnnotationViewController.m index d5b944e19e..d555fa8856 100644 --- a/Classes/BITImageAnnotationViewController.m +++ b/Classes/BITImageAnnotationViewController.m @@ -52,7 +52,6 @@ self.navigationItem.titleView = self.editingControls; - self.objects = [NSMutableArray new]; [self.editingControls addTarget:self action:@selector(editingAction:) forControlEvents:UIControlEventTouchUpInside]; @@ -146,7 +145,13 @@ self.currentAnnotation = [self annotationForCurrentMode]; [self.objects addObject:self.currentAnnotation]; self.currentAnnotation.sourceImage = self.image; - [self.imageView insertSubview:self.currentAnnotation aboveSubview:self.imageView]; + + if (self.imageView.subviews.count > 0 && [self.currentAnnotation isKindOfClass:[BITBlurImageAnnotation class]]){ + [self.imageView insertSubview:self.currentAnnotation belowSubview:[self firstAnnotationThatIsNotBlur]]; + } else { + [self.imageView addSubview:self.currentAnnotation]; + } + self.panStart = [gestureRecognizer locationInView:self.imageView]; [self.editingControls setSelectedSegmentIndex:UISegmentedControlNoSegment]; @@ -176,6 +181,8 @@ annotationFrame.origin.x += delta.x; annotationFrame.origin.y += delta.y; self.currentAnnotation.frame = annotationFrame; + self.currentAnnotation.imageFrame = [self.view convertRect:self.imageView.frame toView:self.currentAnnotation]; + [gestureRecognizer setTranslation:CGPointZero inView:self.view]; @@ -183,7 +190,16 @@ self.currentAnnotation = nil; } } +} + +-(BITImageAnnotation *)firstAnnotationThatIsNotBlur { + for (BITImageAnnotation *annotation in self.imageView.subviews){ + if (![annotation isKindOfClass:[BITBlurImageAnnotation class]]){ + return annotation; + } + } + return self.imageView; } -(void)pinched:(UIPinchGestureRecognizer *)gestureRecognizer { @@ -202,7 +218,7 @@ } } - if (validView){ + if (validView && [candidate resizable]){ self.currentAnnotation = candidate; self.pinchStartingFrame = self.currentAnnotation.frame; } @@ -227,6 +243,8 @@ self.currentAnnotation.frame = newFrame; + self.currentAnnotation.imageFrame = [self.view convertRect:self.imageView.frame toView:self.currentAnnotation]; + // we diff --git a/Classes/BITRectangleImageAnnotation.m b/Classes/BITRectangleImageAnnotation.m index 5fd44c7536..4709d4f4cd 100644 --- a/Classes/BITRectangleImageAnnotation.m +++ b/Classes/BITRectangleImageAnnotation.m @@ -50,13 +50,9 @@ self.strokeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:10].CGPath; } -/* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect -{ - // Drawing code +-(BOOL)resizable { + return YES; } -*/ + @end