Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apple bounding box (CGPathGetPathBoundingBox) #2177

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apple/Elements/RNSVGForeignObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ - (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect
[self setHitArea:path];
if (!CGRectEqualToRect(bounds, CGRectNull)) {
self.clientRect = bounds;
self.fillBounds = CGPathGetBoundingBox(path);
self.strokeBounds = CGPathGetBoundingBox(self.strokePath);
self.fillBounds = CGPathGetPathBoundingBox(path);
self.strokeBounds = CGPathGetPathBoundingBox(self.strokePath);
self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds);

CGAffineTransform current = CGContextGetCTM(context);
Expand Down
4 changes: 2 additions & 2 deletions apple/Elements/RNSVGGroup.mm
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ - (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect
[self setHitArea:path];
if (!CGRectEqualToRect(bounds, CGRectNull)) {
self.clientRect = bounds;
self.fillBounds = CGPathGetBoundingBox(path);
self.strokeBounds = CGPathGetBoundingBox(self.strokePath);
self.fillBounds = CGPathGetPathBoundingBox(path);
self.strokeBounds = CGPathGetPathBoundingBox(self.strokePath);
self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds);

CGAffineTransform current = CGContextGetCTM(context);
Expand Down
4 changes: 2 additions & 2 deletions apple/RNSVGRenderable.mm
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
self.path = CGPathRetain(path);
}
[self setHitArea:path];
self.fillBounds = CGPathGetBoundingBox(path);
self.strokeBounds = CGPathGetBoundingBox(self.strokePath);
self.fillBounds = CGPathGetPathBoundingBox(path);
self.strokeBounds = CGPathGetPathBoundingBox(self.strokePath);
self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds);
}
const CGRect pathBounds = self.pathBounds;
Expand Down
6 changes: 3 additions & 3 deletions apple/RNSVGRenderableModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ @implementation RNSVGRenderableModule
BOOL clipped = [[options objectForKey:@"clipped"] boolValue];
[svg getPath:nil];

CGRect bounds = CGRectZero;
CGRect bounds = CGRectNull;
if (fill) {
bounds = CGRectUnion(bounds, svg.fillBounds);
}
Expand All @@ -150,12 +150,12 @@ @implementation RNSVGRenderableModule
}
if (clipped) {
CGPathRef clipPath = [svg getClipPath];
CGRect clipBounds = CGPathGetBoundingBox(clipPath);
CGRect clipBounds = CGPathGetPathBoundingBox(clipPath);
if (clipPath && !CGRectIsEmpty(clipBounds)) {
bounds = CGRectIntersection(bounds, clipBounds);
}
}

if (CGRectIsNull(bounds)) bounds = CGRectZero;
CGPoint origin = bounds.origin;
CGSize size = bounds.size;
return @{@"x" : @(origin.x), @"y" : @(origin.y), @"width" : @(size.width), @"height" : @(size.height)};
Expand Down
Loading