76 CGPoint pt = CGPointZero; |
58 CGPoint pt = CGPointZero; |
77 switch (cornersPosition) { |
59 switch (cornersPosition) { |
78 case MGCornersPositionLeadingVertical: // top of screen for a left/right split |
60 case MGCornersPositionLeadingVertical: // top of screen for a left/right split |
79 [path moveToPoint:pt]; |
61 [path moveToPoint:pt]; |
80 pt.y += cornerRadius; |
62 pt.y += cornerRadius; |
81 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(90) endAngle:0 clockwise:YES]]; |
63 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(90) endAngle:0 clockwise:YES]]; |
82 pt.x += cornerRadius; |
64 pt.x += cornerRadius; |
83 pt.y -= cornerRadius; |
65 pt.y -= cornerRadius; |
84 [path addLineToPoint:pt]; |
66 [path addLineToPoint:pt]; |
85 [path addLineToPoint:CGPointZero]; |
67 [path addLineToPoint:CGPointZero]; |
86 [path closePath]; |
68 [path closePath]; |
89 pt.y = 0; |
71 pt.y = 0; |
90 [path moveToPoint:pt]; |
72 [path moveToPoint:pt]; |
91 pt.y = maxY; |
73 pt.y = maxY; |
92 [path addLineToPoint:pt]; |
74 [path addLineToPoint:pt]; |
93 pt.x += cornerRadius; |
75 pt.x += cornerRadius; |
94 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(180) endAngle:deg2Rad(90) clockwise:YES]]; |
76 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(90) clockwise:YES]]; |
95 pt.y -= cornerRadius; |
77 pt.y -= cornerRadius; |
96 [path addLineToPoint:pt]; |
78 [path addLineToPoint:pt]; |
97 pt.x -= cornerRadius; |
79 pt.x -= cornerRadius; |
98 [path addLineToPoint:pt]; |
80 [path addLineToPoint:pt]; |
99 [path closePath]; |
81 [path closePath]; |
102 |
84 |
103 case MGCornersPositionTrailingVertical: // bottom of screen for a left/right split |
85 case MGCornersPositionTrailingVertical: // bottom of screen for a left/right split |
104 pt.y = maxY; |
86 pt.y = maxY; |
105 [path moveToPoint:pt]; |
87 [path moveToPoint:pt]; |
106 pt.y -= cornerRadius; |
88 pt.y -= cornerRadius; |
107 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(270) endAngle:deg2Rad(360) clockwise:NO]]; |
89 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(270) endAngle:degreesToRadians(360) clockwise:NO]]; |
108 pt.x += cornerRadius; |
90 pt.x += cornerRadius; |
109 pt.y += cornerRadius; |
91 pt.y += cornerRadius; |
110 [path addLineToPoint:pt]; |
92 [path addLineToPoint:pt]; |
111 pt.x -= cornerRadius; |
93 pt.x -= cornerRadius; |
112 [path addLineToPoint:pt]; |
94 [path addLineToPoint:pt]; |
116 pt.y = maxY; |
98 pt.y = maxY; |
117 [path moveToPoint:pt]; |
99 [path moveToPoint:pt]; |
118 pt.y -= cornerRadius; |
100 pt.y -= cornerRadius; |
119 [path addLineToPoint:pt]; |
101 [path addLineToPoint:pt]; |
120 pt.x += cornerRadius; |
102 pt.x += cornerRadius; |
121 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(180) endAngle:deg2Rad(270) clockwise:NO]]; |
103 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(270) clockwise:NO]]; |
122 pt.y += cornerRadius; |
104 pt.y += cornerRadius; |
123 [path addLineToPoint:pt]; |
105 [path addLineToPoint:pt]; |
124 pt.x -= cornerRadius; |
106 pt.x -= cornerRadius; |
125 [path addLineToPoint:pt]; |
107 [path addLineToPoint:pt]; |
126 [path closePath]; |
108 [path closePath]; |
132 pt.y = cornerRadius; |
114 pt.y = cornerRadius; |
133 [path moveToPoint:pt]; |
115 [path moveToPoint:pt]; |
134 pt.y -= cornerRadius; |
116 pt.y -= cornerRadius; |
135 [path addLineToPoint:pt]; |
117 [path addLineToPoint:pt]; |
136 pt.x += cornerRadius; |
118 pt.x += cornerRadius; |
137 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(180) endAngle:deg2Rad(270) clockwise:NO]]; |
119 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(270) clockwise:NO]]; |
138 pt.y += cornerRadius; |
120 pt.y += cornerRadius; |
139 [path addLineToPoint:pt]; |
121 [path addLineToPoint:pt]; |
140 pt.x -= cornerRadius; |
122 pt.x -= cornerRadius; |
141 [path addLineToPoint:pt]; |
123 [path addLineToPoint:pt]; |
142 [path closePath]; |
124 [path closePath]; |
145 pt.y = maxY - cornerRadius; |
127 pt.y = maxY - cornerRadius; |
146 [path moveToPoint:pt]; |
128 [path moveToPoint:pt]; |
147 pt.y = maxY; |
129 pt.y = maxY; |
148 [path addLineToPoint:pt]; |
130 [path addLineToPoint:pt]; |
149 pt.x += cornerRadius; |
131 pt.x += cornerRadius; |
150 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(180) endAngle:deg2Rad(90) clockwise:YES]]; |
132 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(90) clockwise:YES]]; |
151 pt.y -= cornerRadius; |
133 pt.y -= cornerRadius; |
152 [path addLineToPoint:pt]; |
134 [path addLineToPoint:pt]; |
153 pt.x -= cornerRadius; |
135 pt.x -= cornerRadius; |
154 [path addLineToPoint:pt]; |
136 [path addLineToPoint:pt]; |
155 [path closePath]; |
137 [path closePath]; |
158 |
140 |
159 case MGCornersPositionTrailingHorizontal: // right of screen for a top/bottom split |
141 case MGCornersPositionTrailingHorizontal: // right of screen for a top/bottom split |
160 pt.y = cornerRadius; |
142 pt.y = cornerRadius; |
161 [path moveToPoint:pt]; |
143 [path moveToPoint:pt]; |
162 pt.y -= cornerRadius; |
144 pt.y -= cornerRadius; |
163 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(270) endAngle:deg2Rad(360) clockwise:NO]]; |
145 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(270) endAngle:degreesToRadians(360) clockwise:NO]]; |
164 pt.x += cornerRadius; |
146 pt.x += cornerRadius; |
165 pt.y += cornerRadius; |
147 pt.y += cornerRadius; |
166 [path addLineToPoint:pt]; |
148 [path addLineToPoint:pt]; |
167 pt.x -= cornerRadius; |
149 pt.x -= cornerRadius; |
168 [path addLineToPoint:pt]; |
150 [path addLineToPoint:pt]; |
169 [path closePath]; |
151 [path closePath]; |
170 |
152 |
171 pt.y = maxY - cornerRadius; |
153 pt.y = maxY - cornerRadius; |
172 [path moveToPoint:pt]; |
154 [path moveToPoint:pt]; |
173 pt.y += cornerRadius; |
155 pt.y += cornerRadius; |
174 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:deg2Rad(90) endAngle:0 clockwise:YES]]; |
156 [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(90) endAngle:0 clockwise:YES]]; |
175 pt.x += cornerRadius; |
157 pt.x += cornerRadius; |
176 pt.y -= cornerRadius; |
158 pt.y -= cornerRadius; |
177 [path addLineToPoint:pt]; |
159 [path addLineToPoint:pt]; |
178 pt.x -= cornerRadius; |
160 pt.x -= cornerRadius; |
179 [path addLineToPoint:pt]; |
161 [path addLineToPoint:pt]; |