@@ -678,21 +678,31 @@ export class Path implements IPath {
678678 // TODO: direction is ignored!
679679 const length = params . length ;
680680 let rect : CGRect ;
681+ let radii : number [ ] ;
681682 let rx , ry ;
682683 if ( length === 7 ) {
683684 rect = createCGRect ( params [ 0 ] , params [ 1 ] , params [ 2 ] , params [ 3 ] ) ;
684- rx = params [ 4 ] ;
685- ry = params [ 5 ] ;
685+ radii = [ params [ 4 ] , params [ 5 ] ] ;
686+ } else if ( length === 6 ) {
687+ rect = createCGRect ( params [ 0 ] , params [ 1 ] , params [ 2 ] , params [ 3 ] ) ;
688+ radii = params [ 4 ] ;
686689 } else if ( length === 4 ) {
687690 rect = ( params [ 0 ] as Rect ) . cgRect ;
688- rx = params [ 1 ] ;
689- ry = params [ 2 ] ;
691+ radii = [ params [ 1 ] , params [ 2 ] ] ;
692+ } else if ( length === 3 ) {
693+ rect = ( params [ 0 ] as Rect ) . cgRect ;
694+ radii = params [ 1 ] ;
690695 }
691- if ( this . mBPath ) {
692- this . mBPath . appendPath ( UIBezierPath . bezierPathWithRoundedRectByRoundingCornersCornerRadii ( rect , UIRectCorner . AllCorners , CGSizeMake ( rx , ry ) ) ) ;
696+ if ( ! radii || ! radii . length ) {
697+ throw new Error ( 'missing radii param' ) ;
698+ }
699+ let cgPath ;
700+ if ( radii . length === 2 ) {
701+ cgPath = UIBezierPath . bezierPathWithRoundedRectByRoundingCornersCornerRadii ( rect , UIRectCorner . AllCorners , CGSizeMake ( radii [ 0 ] , radii [ 1 ] ) ) ;
693702 } else {
694- CGPathAddRoundedRect ( this . mPath , null , rect , rx , ry ) ;
703+ throw new Error ( 'multi radii not implemented yet' ) ;
695704 }
705+ this . getOrCreateBPath ( ) . appendPath ( cgPath ) ;
696706 }
697707 addPath ( ...params ) {
698708 const length = params . length ;
@@ -2352,8 +2362,7 @@ export class StaticLayout {
23522362 const width = this . getBounds ( ) . size . width ;
23532363 if ( paint . align === Align . RIGHT ) {
23542364 offsetx -= width ;
2355- }
2356- else {
2365+ } else {
23572366 offsetx -= width / 2 ;
23582367 }
23592368 CGContextTranslateCTM ( ctx , offsetx , 0 ) ;
0 commit comments