mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-05 07:59:28 +00:00
Fix ClipPath position with Text elements
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user