From fb271e8acb64490e1be905a6d324d62f849550ab Mon Sep 17 00:00:00 2001 From: Moritz Haarmann Date: Mon, 28 Apr 2014 01:06:19 +0200 Subject: [PATCH] + Dynamic widths of the outlines, depending on the size of annotations. --- Classes/BITArrowImageAnnotation.m | 11 +++++++++-- Classes/BITRectangleImageAnnotation.m | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Classes/BITArrowImageAnnotation.m b/Classes/BITArrowImageAnnotation.m index 0edc1af006..ae9d6b34fe 100644 --- a/Classes/BITArrowImageAnnotation.m +++ b/Classes/BITArrowImageAnnotation.m @@ -44,10 +44,10 @@ } - (void)buildShape { - CGFloat topHeight = MAX(self.frame.size.width / 3.0f,20); + CGFloat topHeight = MAX(self.frame.size.width / 3.0f,10); - CGFloat lineWidth = MAX(self.frame.size.width / 10.0f,10); + CGFloat lineWidth = MAX(self.frame.size.width / 10.0f,3); CGFloat startX, startY, endX, endY; if ( self.movedDelta.width < 0){ startX = CGRectGetMinX(self.bounds); @@ -71,6 +71,13 @@ self.shapeLayer.path = path.CGPath; self.strokeLayer.path = path.CGPath; + [CATransaction begin]; + [CATransaction setAnimationDuration:0]; + self.strokeLayer.lineWidth = lineWidth/1.5f; + self.shapeLayer.lineWidth = lineWidth / 3.0f; + + [CATransaction commit]; + } -(void)layoutSubviews{ diff --git a/Classes/BITRectangleImageAnnotation.m b/Classes/BITRectangleImageAnnotation.m index 4709d4f4cd..9b677cb360 100644 --- a/Classes/BITRectangleImageAnnotation.m +++ b/Classes/BITRectangleImageAnnotation.m @@ -48,6 +48,15 @@ self.strokeLayer.frame = self.bounds; self.strokeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:10].CGPath; + + CGFloat lineWidth = MAX(self.frame.size.width / 10.0f,10); + + [CATransaction begin]; + [CATransaction setAnimationDuration:0]; + self.strokeLayer.lineWidth = lineWidth/1.5f; + self.shapeLayer.lineWidth = lineWidth / 3.0f; + + [CATransaction commit]; } -(BOOL)resizable {