@@ -678,21 +678,31 @@ export class Path implements IPath {
678
678
// TODO: direction is ignored!
679
679
const length = params . length ;
680
680
let rect : CGRect ;
681
+ let radii : number [ ] ;
681
682
let rx , ry ;
682
683
if ( length === 7 ) {
683
684
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 ] ;
686
689
} else if ( length === 4 ) {
687
690
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 ] ;
690
695
}
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 ] ) ) ;
693
702
} else {
694
- CGPathAddRoundedRect ( this . mPath , null , rect , rx , ry ) ;
703
+ throw new Error ( 'multi radii not implemented yet' ) ;
695
704
}
705
+ this . getOrCreateBPath ( ) . appendPath ( cgPath ) ;
696
706
}
697
707
addPath ( ...params ) {
698
708
const length = params . length ;
@@ -2352,8 +2362,7 @@ export class StaticLayout {
2352
2362
const width = this . getBounds ( ) . size . width ;
2353
2363
if ( paint . align === Align . RIGHT ) {
2354
2364
offsetx -= width ;
2355
- }
2356
- else {
2365
+ } else {
2357
2366
offsetx -= width / 2 ;
2358
2367
}
2359
2368
CGContextTranslateCTM ( ctx , offsetx , 0 ) ;
0 commit comments