@@ -551,8 +551,8 @@ export class Path implements IPath {
551
551
private mBPath ?: UIBezierPath ;
552
552
private mFillType : FillType ;
553
553
554
- constructor ( ) {
555
- this . mPath = CGPathCreateMutable ( ) ;
554
+ constructor ( path ?: Path ) {
555
+ this . mPath = path ? CGPathCreateMutableCopy ( path . getCGPath ( ) ) : CGPathCreateMutable ( ) ;
556
556
this . mFillType = FillType . WINDING ;
557
557
// this._path = UIBezierPath.bezierPath();
558
558
}
@@ -611,7 +611,7 @@ export class Path implements IPath {
611
611
if ( points . length <= 0 || points . length % 2 !== 0 ) {
612
612
console . error ( 'wrong points number' ) ;
613
613
}
614
- UIBezierPath . addLinesOffsetCountCloseToPath ( points , offset , length , close , this . mPath ) ;
614
+ UIBezierPath . addLinesOffsetCountCloseToPath ( points , offset , length , close , this . getCGPath ( ) ) ;
615
615
}
616
616
setLines ( points : number [ ] , offset ?: number , length ?: number , close ?: boolean ) {
617
617
this . reset ( ) ;
@@ -632,7 +632,7 @@ export class Path implements IPath {
632
632
// if (close === true) {
633
633
// CGPathCloseSubpath(this._path);
634
634
// }
635
- UIBezierPath . addCubicLinesOffsetCountCloseToPath ( points , offset , length , close , this . mPath ) ;
635
+ UIBezierPath . addCubicLinesOffsetCountCloseToPath ( points , offset , length , close , this . getCGPath ( ) ) ;
636
636
}
637
637
setCubicLines ( points : number [ ] , offset ?: number , length ?: number , close ?: boolean ) {
638
638
this . reset ( ) ;
@@ -909,7 +909,7 @@ export class Path implements IPath {
909
909
//@ts -ignore
910
910
set ( path : Path ) : void {
911
911
this . mBPath = null ;
912
- this . mPath = CGPathCreateMutableCopy ( path . mPath ) ;
912
+ this . mPath = CGPathCreateMutableCopy ( path . getCGPath ( ) ) ;
913
913
}
914
914
}
915
915
0 commit comments