Fix ClipPath position with Text elements

This commit is contained in:
Horcrux
2016-11-11 14:10:19 +08:00
parent 0434cddc8b
commit 44860a02ff
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -16,5 +16,6 @@
@interface RNSVGGroup : RNSVGPath <RNSVGContainer> @interface RNSVGGroup : RNSVGPath <RNSVGContainer>
- (void)pathRenderLayerTo:(CGContextRef)contex; - (void)pathRenderLayerTo:(CGContextRef)contex;
- (void)renderLayerToWithTransform:(CGContextRef)context transform:(CGAffineTransform)transform;
@end @end
+7
View File
@@ -11,9 +11,16 @@
@implementation RNSVGGroup @implementation RNSVGGroup
- (void)renderLayerTo:(CGContextRef)context - (void)renderLayerTo:(CGContextRef)context
{
[self renderLayerToWithTransform:context transform:CGAffineTransformIdentity];
}
- (void)renderLayerToWithTransform:(CGContextRef)context transform:(CGAffineTransform)transform
{ {
RNSVGSvgView* svg = [self getSvgView]; RNSVGSvgView* svg = [self getSvgView];
[self clip:context]; [self clip:context];
CGContextConcatCTM(context, transform);
[self traverseSubviews:^(RNSVGNode *node) { [self traverseSubviews:^(RNSVGNode *node) {
if (node.responsible && !svg.responsible) { if (node.responsible && !svg.responsible) {
svg.responsible = YES; svg.responsible = YES;
+2 -2
View File
@@ -25,8 +25,8 @@
- (void)renderLayerTo:(CGContextRef)context - (void)renderLayerTo:(CGContextRef)context
{ {
CGContextSaveGState(context); CGContextSaveGState(context);
CGContextConcatCTM(context, CGAffineTransformMakeTranslation([self getShift:context path:nil], 0)); CGAffineTransform transform = CGAffineTransformMakeTranslation([self getShift:context path:nil], 0);
[super renderLayerTo:context]; [super renderLayerToWithTransform:context transform:transform];
CGContextRestoreGState(context); CGContextRestoreGState(context);
} }