Skip to content

Commit a6db92a

Browse files
authored
Merge pull request #81 from panter/plane-corner-radius
allow to specify cornerRadius and other props on planes
2 parents 11a9c1a + 0b5d53d commit a6db92a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

components/ARPlane.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const ARPlane = createArComponent('addPlane', {
1313
shape: PropTypes.shape({
1414
width: PropTypes.number,
1515
height: PropTypes.number,
16+
cornerRadius: PropTypes.number,
17+
cornerSegmentCount: PropTypes.number,
18+
widthSegmentCount: PropTypes.number,
19+
heightSegmentCount: PropTypes.number,
1620
}),
1721
});
1822

ios/RCTConvert+ARKit.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,18 @@ + (SCNPlane *)SCNPlane:(id)json {
149149
CGFloat width = [shape[@"width"] floatValue];
150150
CGFloat height = [shape[@"height"] floatValue];
151151
SCNPlane *geometry = [SCNPlane planeWithWidth:width height:height];
152-
152+
if(shape[@"cornerRadius"]) {
153+
geometry.cornerRadius = [shape[@"cornerRadius"] floatValue];
154+
}
155+
if(shape[@"cornerSegmentCount"]) {
156+
geometry.cornerSegmentCount = [shape[@"cornerSegmentCount"] intValue];
157+
}
158+
if(shape[@"widthSegmentCount"]) {
159+
geometry.widthSegmentCount = [shape[@"widthSegmentCount"] intValue];
160+
}
161+
if(shape[@"heightSegmentCount"]) {
162+
geometry.heightSegmentCount = [shape[@"heightSegmentCount"] intValue];
163+
}
153164
SCNMaterial *material = [self SCNMaterial:json[@"material"]];
154165
material.doubleSided = YES;
155166
geometry.materials = @[material];

0 commit comments

Comments
 (0)