mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 23:16:13 +00:00
fix percentage bug, add Svg element flex layout support
This commit is contained in:
+3
-3
@@ -52,7 +52,7 @@
|
||||
// draw ellipse
|
||||
CGFloat cx = [self getActualProp:@"cx" relative:width];
|
||||
CGFloat cy = [self getActualProp:@"cy" relative:height];
|
||||
CGFloat rx = [self getActualProp:@"rx" relative:height];
|
||||
CGFloat rx = [self getActualProp:@"rx" relative:width];
|
||||
CGFloat ry = [self getActualProp:@"ry" relative:height];
|
||||
CGPathAddEllipseInRect(path, nil, CGRectMake(cx - rx, cy - ry, rx * 2, ry * 2));
|
||||
break;
|
||||
@@ -60,9 +60,9 @@
|
||||
case 2:
|
||||
{
|
||||
// draw line
|
||||
CGFloat x1 = [self getActualProp:@"x1" relative:height];
|
||||
CGFloat x1 = [self getActualProp:@"x1" relative:width];
|
||||
CGFloat y1 = [self getActualProp:@"y1" relative:height];
|
||||
CGFloat x2 = [self getActualProp:@"x2" relative:height];
|
||||
CGFloat x2 = [self getActualProp:@"x2" relative:width];
|
||||
CGFloat y2 = [self getActualProp:@"y2" relative:height];
|
||||
CGPathMoveToPoint(path, nil, x1, y1);
|
||||
CGPathAddLineToPoint(path, nil, x2, y2);
|
||||
|
||||
@@ -11,5 +11,4 @@
|
||||
#import "RNSVGContainer.h"
|
||||
|
||||
@interface RNSVGSvgView : UIView <RNSVGContainer>
|
||||
|
||||
@end
|
||||
|
||||
+6
-6
@@ -15,20 +15,20 @@
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
[self setNeedsDisplay];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
for (RNSVGNode *node in self.subviews) {
|
||||
[node renderTo:context];
|
||||
}
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
for (RNSVGNode *node in self.subviews) {
|
||||
[node renderTo:context];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reactSetInheritedBackgroundColor:(UIColor *)inheritedBackgroundColor
|
||||
{
|
||||
self.backgroundColor = inheritedBackgroundColor;
|
||||
self.backgroundColor = inheritedBackgroundColor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -16,7 +16,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [RNSVGSvgView new];
|
||||
return [RNSVGSvgView new];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user