mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 15:44:24 +00:00
Revert "Revert "change circle radius percentage calculation""
This reverts commit f717d8bd93.
This commit is contained in:
+14
-1
@@ -30,7 +30,20 @@
|
||||
// draw circle
|
||||
CGFloat cx = [self getActualProp:@"cx" relative:width];
|
||||
CGFloat cy = [self getActualProp:@"cy" relative:height];
|
||||
CGFloat r = [self getActualProp:@"r" relative:height];
|
||||
|
||||
|
||||
CGFloat r;
|
||||
// radius in percentage calculate formula:
|
||||
// radius = sqrt(pow((width*percent), 2) + pow((height*percent), 2)) / sqrt(2)
|
||||
NSDictionary *prop = [self.shape objectForKey:@"r"];
|
||||
CGFloat value = [[prop objectForKey:@"value"] floatValue];
|
||||
if ([[prop objectForKey:@"percentage"] integerValue] == 1) {
|
||||
r = sqrt(pow((width * value), 2) + pow((height * value), 2)) / sqrt(2);
|
||||
|
||||
} else {
|
||||
r = value;
|
||||
}
|
||||
|
||||
CGPathAddArc(path, nil, cx, cy, r, -M_PI, M_PI, YES);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user