fix percentage bug, add Svg element flex layout support

This commit is contained in:
Horcrux
2016-04-29 21:26:04 +08:00
parent 6458e9d4f9
commit 5008457ba6
7 changed files with 79 additions and 26 deletions
+3 -3
View File
@@ -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);
-1
View File
@@ -11,5 +11,4 @@
#import "RNSVGContainer.h"
@interface RNSVGSvgView : UIView <RNSVGContainer>
@end
+6 -6
View File
@@ -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
+1 -1
View File
@@ -16,7 +16,7 @@ RCT_EXPORT_MODULE()
- (UIView *)view
{
return [RNSVGSvgView new];
return [RNSVGSvgView new];
}
@end