Skip to content

Commit 7b55731

Browse files
authored
Merge pull request #38 from cjycsm/main
fix issue #36: boundsForElement function is missing kCGPathElementAddQuadCurveToPoint type
2 parents ffd5acf + 5fd8a73 commit 7b55731

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ClippingBezier.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ClippingBezier"
3-
s.version = "1.2.4"
3+
s.version = "1.2.5"
44
s.summary = "This library adds categories to UIBezierPath to simplify clipping a single closed UIBezierPath with another closed or unclosed UIBezierPath."
55
s.author = {
66
'Adam Wulf' => 'adam.wulf@gmail.com',

ClippingBezier/UIBezierPath+Intersections.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ CGRect boundsForElement(CGPoint startPoint, CGPathElement element, CGPoint pathS
325325
CGFloat maxX = MAX(MAX(MAX(startPoint.x, element.points[0].x), element.points[1].x), element.points[2].x);
326326
CGFloat maxY = MAX(MAX(MAX(startPoint.y, element.points[0].y), element.points[1].y), element.points[2].y);
327327
return CGRectMake(minX, minY, maxX - minX, maxY - minY);
328+
} else if (element.type == kCGPathElementAddQuadCurveToPoint) {
329+
CGFloat minX = MIN(MIN(startPoint.x, element.points[0].x), element.points[1].x);
330+
CGFloat minY = MIN(MIN(startPoint.y, element.points[0].y), element.points[1].y);
331+
CGFloat maxX = MAX(MAX(startPoint.x, element.points[0].x), element.points[1].x);
332+
CGFloat maxY = MAX(MAX(startPoint.y, element.points[0].y), element.points[1].y);
333+
return CGRectMake(minX, minY, maxX - minX, maxY - minY);
328334
} else if (element.type == kCGPathElementMoveToPoint) {
329335
return CGRectMake(element.points[0].x, element.points[0].y, 0, 0);
330336
} else if (element.type == kCGPathElementCloseSubpath) {

0 commit comments

Comments
 (0)