+ Fixed Blur z-index.

This commit is contained in:
moritz haarmann 2014-03-19 13:10:44 +01:00
parent a1c27492ee
commit eba31ba279
5 changed files with 30 additions and 21 deletions

View File

@ -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;

View File

@ -12,4 +12,7 @@
@property (nonatomic) CGSize movedDelta;
@property (nonatomic, weak) UIImage *sourceImage;
@property (nonatomic) CGRect imageFrame;
-(BOOL)resizable;
@end

View File

@ -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

View File

@ -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

View File

@ -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