File tree Expand file tree Collapse file tree 5 files changed +14
-2
lines changed
android/src/main/java/com/horcrux/svg Expand file tree Collapse file tree 5 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,7 @@ public void setResponsible(boolean responsible) {
333
333
if (mClipNode != null ) {
334
334
Path clipPath = mClipNode .mClipRule == CLIP_RULE_EVENODD ? mClipNode .getPath (canvas , paint ) :
335
335
mClipNode .getPath (canvas , paint , Region .Op .UNION );
336
+ clipPath .transform (mClipNode .mMatrix );
336
337
switch (mClipNode .mClipRule ) {
337
338
case CLIP_RULE_EVENODD :
338
339
clipPath .setFillType (Path .FillType .EVEN_ODD );
Original file line number Diff line number Diff line change @@ -314,7 +314,9 @@ - (CGPathRef)getClipPath:(CGContextRef)context
314
314
if (_cachedClipPath) {
315
315
CGPathRelease (_cachedClipPath);
316
316
}
317
- _cachedClipPath = CGPathRetain ([_clipNode getPath: context]);
317
+ CGAffineTransform transform = _clipNode.matrix ;
318
+ _cachedClipPath = CGPathCreateCopyByTransformingPath ([_clipNode getPath: context], &transform);
319
+ CGPathRetain (_cachedClipPath);
318
320
if (_clipMask) {
319
321
CGImageRelease (_clipMask);
320
322
}
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { requireNativeComponent } from 'react-native' ;
3
3
import extractClipPath from '../lib/extract/extractClipPath' ;
4
+ import { TransformProps } from '../lib/extract/types' ;
4
5
import Shape from './Shape' ;
5
6
6
7
export default class ClipPath extends Shape < {
7
8
id ?: string ;
8
9
clipPath ?: string ;
9
10
clipRule ?: 'evenodd' | 'nonzero' ;
11
+ transform ?: number [ ] | string | TransformProps ;
10
12
} > {
11
13
static displayName = 'ClipPath' ;
12
14
Original file line number Diff line number Diff line change 1
1
import { idPattern } from '../util' ;
2
2
import { ClipProps } from './types' ;
3
+ import extractTransform from './extractTransform' ;
3
4
4
5
const clipRules : { evenodd : number ; nonzero : number } = {
5
6
evenodd : 0 ,
6
7
nonzero : 1 ,
7
8
} ;
8
9
9
10
export default function extractClipPath ( props : ClipProps ) {
10
- const { clipPath, clipRule } = props ;
11
+ const { clipPath, clipRule, transform } = props ;
11
12
const extracted : {
12
13
clipPath ?: string ;
13
14
clipRule ?: number ;
15
+ matrix ?: number [ ] ;
14
16
} = { } ;
15
17
16
18
if ( clipRule ) {
@@ -31,5 +33,9 @@ export default function extractClipPath(props: ClipProps) {
31
33
}
32
34
}
33
35
36
+ if ( transform ) {
37
+ extracted . matrix = extractTransform ( transform ) ;
38
+ }
39
+
34
40
return extracted ;
35
41
}
Original file line number Diff line number Diff line change @@ -92,4 +92,5 @@ export type StrokeProps = {
92
92
export type ClipProps = {
93
93
clipPath ?: string ;
94
94
clipRule ?: 'evenodd' | 'nonzero' ;
95
+ transform ?: number [ ] | string | TransformProps ;
95
96
} ;
You can’t perform that action at this time.
0 commit comments