modify the examples

This commit is contained in:
Horcrux
2016-08-05 17:02:02 +08:00
parent ced362bc75
commit 076e6c1304
4 changed files with 20 additions and 26 deletions

View File

@@ -127,6 +127,7 @@ class ClipPathElement extends Component{
/> />
</RadialGradient> </RadialGradient>
<ClipPath id="clip"> <ClipPath id="clip">
<G scale="0.9" x="10">
<Circle cx="30" cy="30" r="20"/> <Circle cx="30" cy="30" r="20"/>
<Ellipse cx="60" cy="70" rx="20" ry="10" /> <Ellipse cx="60" cy="70" rx="20" ry="10" />
<Rect x="65" y="15" width="30" height="30" /> <Rect x="65" y="15" width="30" height="30" />
@@ -138,6 +139,7 @@ class ClipPathElement extends Component{
fonWeight="bold" fonWeight="bold"
textAnchor="middle" textAnchor="middle"
>Q</Text> >Q</Text>
</G>
</ClipPath> </ClipPath>
</Defs> </Defs>
<Rect <Rect

View File

@@ -64,9 +64,9 @@ class HoverExample extends Component {
delayPressIn={0} delayPressIn={0}
onPressIn={this.toggle} onPressIn={this.toggle}
onPressOut={this.toggle} onPressOut={this.toggle}
x="20" x="0"
y="10" y="10"
scale="0.75" scale="0.5"
/> />
</Svg>; </Svg>;
} }
@@ -80,12 +80,11 @@ class GroupExample extends Component {
height="120" height="120"
width="120" width="120"
viewBox="0 0 240 240" viewBox="0 0 240 240"
preserveAspectRatio="none"
> >
<G onPress={() => alert('Pressed')}> <G onPress={() => alert('Pressed')}>
<Circle cx="80" cy="80" r="30" fill="green" x="20" />
<Rect x="20" y="20" width="40" height="40" fill="yellow"/> <Rect x="20" y="20" width="40" height="40" fill="yellow"/>
<Circle cx="80" cy="80" r="30" fill="green"/> <Text fontWeight="bold" fontSize="40" x="100" y="100" scale="2">H</Text>
<Text fontWeight="bold" fontSize="40" x="100" y="100">H</Text>
</G> </G>
</Svg>; </Svg>;
} }

View File

@@ -30,17 +30,11 @@
@property (nonatomic, copy) NSArray<NSString *> *propList; @property (nonatomic, copy) NSArray<NSString *> *propList;
- (void)setBoundingBox:(CGContextRef)context; - (void)setBoundingBox:(CGContextRef)context;
- (CGFloat)getWidthRelatedValue:(NSString *)string; - (CGFloat)getWidthRelatedValue:(NSString *)string;
- (CGFloat)getHeightRelatedValue:(NSString *)string; - (CGFloat)getHeightRelatedValue:(NSString *)string;
- (CGFloat)getContextWidth; - (CGFloat)getContextWidth;
- (CGFloat)getContextHeight; - (CGFloat)getContextHeight;
- (CGFloat)getContextX; - (CGFloat)getContextX;
- (CGFloat)getContextY; - (CGFloat)getContextY;

View File

@@ -96,9 +96,8 @@
} }
} }
CGAffineTransform transform = CGAffineTransformMakeScale(scaleX, scaleY); self.transform = CGAffineTransformScale(self.transform, scaleX, scaleY);
transform = CGAffineTransformTranslate(transform, -translateX * (_fromSymbol ? scaleX : 1), -translateY * (_fromSymbol ? scaleY : 1)); self.transform = CGAffineTransformTranslate(self.transform, -translateX * (_fromSymbol ? scaleX : 1), -translateY * (_fromSymbol ? scaleY : 1));
CGContextConcatCTM(context, transform);
[super renderTo:context]; [super renderTo:context];
} }