CR: simplify

pull/1/head
Michael Kirk 7 years ago
parent 287da9c30a
commit 900abf2367

@ -578,7 +578,7 @@ NS_ASSUME_NONNULL_BEGIN
if (self.viewItem.senderName) { if (self.viewItem.senderName) {
return UIRectCornerAllCorners; return UIRectCornerAllCorners;
} else { } else {
return self.sharpCorners & UIRectCornerAllCorners; return self.sharpCorners | UIRectCornerBottomLeft | UIRectCornerBottomRight;
} }
} }

@ -172,20 +172,19 @@ NS_ASSUME_NONNULL_BEGIN
const CGFloat topRightRounding const CGFloat topRightRounding
= (sharpCorners & UIRectCornerTopRight) ? sharpCornerRadius : wideCornerRadius; = (sharpCorners & UIRectCornerTopRight) ? sharpCornerRadius : wideCornerRadius;
// bottom corners are always sharp const CGFloat bottomRightRounding
const CGFloat bottomRightRounding = sharpCornerRadius; = (sharpCorners & UIRectCornerBottomRight) ? sharpCornerRadius : wideCornerRadius;
const CGFloat bottomLeftRounding = sharpCornerRadius; const CGFloat bottomLeftRounding
= (sharpCorners & UIRectCornerBottomLeft) ? sharpCornerRadius : wideCornerRadius;
const CGFloat topAngle = 3.0f * M_PI / 2.0f; const CGFloat topAngle = 3.0f * M_PI_2;
const CGFloat rightAngle = 0.0f; const CGFloat rightAngle = 0.0f;
const CGFloat bottomAngle = M_PI / 2.0f; const CGFloat bottomAngle = M_PI_2;
const CGFloat leftAngle = M_PI; const CGFloat leftAngle = M_PI;
// starting just to the right of the top left corner and working clockwise // starting just to the right of the top left corner and working clockwise
[bezierPath moveToPoint:CGPointMake(bubbleLeft + topLeftRounding, bubbleTop)]; [bezierPath moveToPoint:CGPointMake(bubbleLeft + topLeftRounding, bubbleTop)];
// top line
[bezierPath addLineToPoint:CGPointMake(bubbleRight - topRightRounding, bubbleTop)];
// top right corner // top right corner
[bezierPath addArcWithCenter:CGPointMake(bubbleRight - topRightRounding, bubbleTop + topRightRounding) [bezierPath addArcWithCenter:CGPointMake(bubbleRight - topRightRounding, bubbleTop + topRightRounding)
@ -194,9 +193,6 @@ NS_ASSUME_NONNULL_BEGIN
endAngle:rightAngle endAngle:rightAngle
clockwise:true]; clockwise:true];
// right line
[bezierPath addLineToPoint:CGPointMake(bubbleRight, bubbleBottom - bottomRightRounding)];
// bottom right corner // bottom right corner
[bezierPath [bezierPath
addArcWithCenter:CGPointMake(bubbleRight - bottomRightRounding, bubbleBottom - bottomRightRounding) addArcWithCenter:CGPointMake(bubbleRight - bottomRightRounding, bubbleBottom - bottomRightRounding)
@ -205,9 +201,6 @@ NS_ASSUME_NONNULL_BEGIN
endAngle:bottomAngle endAngle:bottomAngle
clockwise:true]; clockwise:true];
// bottom line
[bezierPath addLineToPoint:CGPointMake(bubbleLeft + bottomLeftRounding, bubbleBottom)];
// bottom left corner // bottom left corner
[bezierPath addArcWithCenter:CGPointMake(bubbleLeft + bottomLeftRounding, bubbleBottom - bottomLeftRounding) [bezierPath addArcWithCenter:CGPointMake(bubbleLeft + bottomLeftRounding, bubbleBottom - bottomLeftRounding)
radius:bottomLeftRounding radius:bottomLeftRounding
@ -215,9 +208,6 @@ NS_ASSUME_NONNULL_BEGIN
endAngle:leftAngle endAngle:leftAngle
clockwise:true]; clockwise:true];
// left line
[bezierPath addLineToPoint:CGPointMake(bubbleLeft, bubbleTop + topLeftRounding)];
// top left corner // top left corner
[bezierPath addArcWithCenter:CGPointMake(bubbleLeft + topLeftRounding, bubbleTop + topLeftRounding) [bezierPath addArcWithCenter:CGPointMake(bubbleLeft + topLeftRounding, bubbleTop + topLeftRounding)
radius:topLeftRounding radius:topLeftRounding

Loading…
Cancel
Save